• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SendConf类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ws.com.google.android.mms.pdu.SendConf的典型用法代码示例。如果您正苦于以下问题:Java SendConf类的具体用法?Java SendConf怎么用?Java SendConf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SendConf类属于ws.com.google.android.mms.pdu包,在下文中一共展示了SendConf类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Nullable
@Override
public SendConf send(@NonNull byte[] pduBytes, int subscriptionId)
    throws UndeliverableMessageException
{
  if (subscriptionId == -1 || VERSION.SDK_INT < 22) {
    Log.w(TAG, "Sending via legacy connection");
    try {
      SendConf result = new OutgoingLegacyMmsConnection(context).send(pduBytes, subscriptionId);

      if (result != null && result.getResponseStatus() == PduHeaders.RESPONSE_STATUS_OK) {
        return result;
      } else {
        Log.w(TAG, "Got bad legacy response: " + (result != null ? result.getResponseStatus() : null));
      }
    } catch (UndeliverableMessageException | ApnUnavailableException e) {
      Log.w(TAG, e);
    }
  }

  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
    return new OutgoingLollipopMmsConnection(context).send(pduBytes, subscriptionId);
  } else {
    throw new UndeliverableMessageException("Lollipop API not available to try...");
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:27,代码来源:CompatMmsConnection.java


示例2: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Override
@TargetApi(VERSION_CODES.LOLLIPOP)
public @Nullable synchronized SendConf send(@NonNull byte[] pduBytes, int subscriptionId)
    throws UndeliverableMessageException
{
  beginTransaction();
  try {
    MmsBodyProvider.Pointer pointer = MmsBodyProvider.makeTemporaryPointer(getContext());
    Util.copy(new ByteArrayInputStream(pduBytes), pointer.getOutputStream());

    SmsManager smsManager;

    if (VERSION.SDK_INT >= 22 && subscriptionId != -1) {
      smsManager = SmsManager.getSmsManagerForSubscriptionId(subscriptionId);
    } else {
      smsManager = SmsManager.getDefault();
    }

    smsManager.sendMultimediaMessage(getContext(),
                                     pointer.getUri(),
                                     null,
                                     null,
                                     getPendingIntent());

    waitForResult();

    Log.w(TAG, "MMS broadcast received and processed.");
    pointer.close();

    if (response == null) {
      throw new UndeliverableMessageException("Null response.");
    }

    return (SendConf) new PduParser(response).parse();
  } catch (IOException | TimeoutException e) {
    throw new UndeliverableMessageException(e);
  } finally {
    endTransaction();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:41,代码来源:OutgoingLollipopMmsConnection.java


示例3: getSendResult

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private MmsSendResult getSendResult(SendConf conf, SendReq message)
    throws UndeliverableMessageException
{
  if (conf == null) {
    throw new UndeliverableMessageException("No M-Send.conf received in response to send.");
  } else if (conf.getResponseStatus() != PduHeaders.RESPONSE_STATUS_OK) {
    throw new UndeliverableMessageException("Got bad response: " + conf.getResponseStatus());
  } else if (isInconsistentResponse(message, conf)) {
    throw new UndeliverableMessageException("Mismatched response!");
  } else {
    return new MmsSendResult(conf.getMessageId(), conf.getResponseStatus());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:14,代码来源:MmsSendJob.java


示例4: sendMms

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private MmsSendResult sendMms(MasterSecret masterSecret, MmsRadio radio, SendReq message,
                              boolean usingMmsRadio, boolean useProxy)
    throws IOException, UndeliverableMessageException, InsecureFallbackApprovalException
{
  String  number         = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number();
  boolean upgradedSecure = false;

  if (MmsDatabase.Types.isSecureType(message.getDatabaseMessageBox())) {
    message        = getEncryptedMessage(masterSecret, message);
    upgradedSecure = true;
  }

  if (number != null && number.trim().length() != 0) {
    message.setFrom(new EncodedStringValue(number));
  }

  try {
    OutgoingMmsConnection connection = new OutgoingMmsConnection(context, radio.getApnInformation(), new PduComposer(context, message).make());
    SendConf conf = connection.send(usingMmsRadio, useProxy);

    for (int i=0;i<message.getBody().getPartsNum();i++) {
      Log.w(TAG, "Sent MMS part of content-type: " + new String(message.getBody().getPart(i).getContentType()));
    }

    if (conf == null) {
      throw new UndeliverableMessageException("No M-Send.conf received in response to send.");
    } else if (conf.getResponseStatus() != PduHeaders.RESPONSE_STATUS_OK) {
      throw new UndeliverableMessageException("Got bad response: " + conf.getResponseStatus());
    } else if (isInconsistentResponse(message, conf)) {
      throw new UndeliverableMessageException("Mismatched response!");
    } else {
      return new MmsSendResult(conf.getMessageId(), conf.getResponseStatus(), upgradedSecure, false);
    }
  } catch (ApnUnavailableException aue) {
    throw new IOException("no APN was retrievable");
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:38,代码来源:MmsSendJob.java


示例5: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Nullable @Override public SendConf send(@NonNull byte[] pduBytes)
    throws UndeliverableMessageException
{
  try {
    Log.w(TAG, "Sending via legacy connection");
    return new OutgoingLegacyMmsConnection(context).send(pduBytes);
  } catch (UndeliverableMessageException | ApnUnavailableException e) {
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
      Log.w(TAG, "Falling back to try sending via Lollipop API");
      return new OutgoingLollipopMmsConnection(context).send(pduBytes);
    } else {
      throw new UndeliverableMessageException(e);
    }
  }
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:16,代码来源:CompatMmsConnection.java


示例6: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Override
@TargetApi(VERSION_CODES.LOLLIPOP)
public @Nullable synchronized SendConf send(@NonNull byte[] pduBytes) throws UndeliverableMessageException {
  beginTransaction();
  try {
    MmsBodyProvider.Pointer pointer = MmsBodyProvider.makeTemporaryPointer(getContext());
    Util.copy(new ByteArrayInputStream(pduBytes), pointer.getOutputStream());

    SmsManager.getDefault().sendMultimediaMessage(getContext(),
                                                  pointer.getUri(),
                                                  null,
                                                  null,
                                                  getPendingIntent());

    waitForResult();

    Log.w(TAG, "MMS broadcast received and processed.");
    pointer.close();

    if (response == null) {
      throw new UndeliverableMessageException("Null response.");
    }

    return (SendConf) new PduParser(response).parse();
  } catch (IOException | TimeoutException e) {
    throw new UndeliverableMessageException(e);
  } finally {
    endTransaction();
  }
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:31,代码来源:OutgoingLollipopMmsConnection.java


示例7: onSend

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Override
public void onSend(MasterSecret masterSecret) throws MmsException, NoSuchMessageException, IOException {
  MmsDatabase          database = DatabaseFactory.getMmsDatabase(context);
  OutgoingMediaMessage message  = database.getOutgoingMessage(masterSecret, messageId);

  try {
    boolean upgradedSecure = false;

    SendReq pdu = constructSendPdu(masterSecret, message);

    if (message.isSecure()) {
      Log.w(TAG, "Encrypting MMS...");
      pdu = getEncryptedMessage(masterSecret, pdu);
      upgradedSecure = true;
    }

    validateDestinations(message, pdu);

    final byte[]        pduBytes = getPduBytes(masterSecret, pdu);
    final SendConf      sendConf = new CompatMmsConnection(context).send(pduBytes, message.getSubscriptionId());
    final MmsSendResult result   = getSendResult(sendConf, pdu, upgradedSecure);

    database.markAsSent(messageId, result.isUpgradedSecure());
    markAttachmentsUploaded(messageId, message.getAttachments());
  } catch (UndeliverableMessageException | IOException e) {
    Log.w(TAG, e);
    database.markAsSentFailed(messageId);
    notifyMediaMessageDeliveryFailed(context, messageId);
  }
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:31,代码来源:MmsSendJob.java


示例8: getSendResult

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private MmsSendResult getSendResult(SendConf conf, SendReq message, boolean upgradedSecure)
    throws UndeliverableMessageException
{
  if (conf == null) {
    throw new UndeliverableMessageException("No M-Send.conf received in response to send.");
  } else if (conf.getResponseStatus() != PduHeaders.RESPONSE_STATUS_OK) {
    throw new UndeliverableMessageException("Got bad response: " + conf.getResponseStatus());
  } else if (isInconsistentResponse(message, conf)) {
    throw new UndeliverableMessageException("Mismatched response!");
  } else {
    return new MmsSendResult(conf.getMessageId(), conf.getResponseStatus(), upgradedSecure, false);
  }
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:14,代码来源:MmsSendJob.java


示例9: sendMms

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private MmsSendResult sendMms(SendReq message, boolean usingMmsRadio, boolean useProxy)
    throws IOException, UndeliverableMessageException, InsecureFallbackApprovalException
{
  String  number         = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number();
  boolean upgradedSecure = false;

  if (MmsDatabase.Types.isSecureType(message.getDatabaseMessageBox())) {
    message        = getEncryptedMessage(message);
    upgradedSecure = true;
  }

  if (number != null && number.trim().length() != 0) {
    message.setFrom(new EncodedStringValue(number));
  }

  SendConf conf = MmsSendHelper.sendMms(context, new PduComposer(context, message).make(),
                                        radio.getApnInformation(), usingMmsRadio, useProxy);

  for (int i=0;i<message.getBody().getPartsNum();i++) {
    Log.w("MmsSender", "Sent MMS part of content-type: " + new String(message.getBody().getPart(i).getContentType()));
  }

  if (conf == null) {
    throw new UndeliverableMessageException("No M-Send.conf received in response to send.");
  } else if (conf.getResponseStatus() != PduHeaders.RESPONSE_STATUS_OK) {
    throw new UndeliverableMessageException("Got bad response: " + conf.getResponseStatus());
  } else if (isInconsistentResponse(message, conf)) {
    throw new UndeliverableMessageException("Mismatched response!");
  } else {
    return new MmsSendResult(conf.getMessageId(), conf.getResponseStatus(), upgradedSecure, false);
  }
}
 
开发者ID:Securecom,项目名称:Securecom-Text,代码行数:33,代码来源:MmsTransport.java


示例10: sendMms

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
public static SendConf sendMms(Context context, byte[] mms, String apn,
                               boolean usingMmsRadio, boolean useProxyIfAvailable)
    throws IOException
{
  byte[] response = sendBytes(context, mms, apn, usingMmsRadio, useProxyIfAvailable);
  return (SendConf) new PduParser(response).parse();
}
 
开发者ID:Securecom,项目名称:Securecom-Text,代码行数:8,代码来源:MmsSendHelper.java


示例11: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private SendConf send(byte[] pduBytes, boolean useMmsRadio, boolean useProxyIfAvailable)  throws IOException {
  byte[] response = sendBytes(pduBytes, useMmsRadio, useProxyIfAvailable);
  return (SendConf) new PduParser(response).parse();
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:5,代码来源:OutgoingLegacyMmsConnection.java


示例12: isInconsistentResponse

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private boolean isInconsistentResponse(SendReq message, SendConf response) {
  Log.w(TAG, "Comparing: " + Hex.toString(message.getTransactionId()));
  Log.w(TAG, "With:      " + Hex.toString(response.getTransactionId()));
  return !Arrays.equals(message.getTransactionId(), response.getTransactionId());
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:6,代码来源:MmsSendJob.java


示例13: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
public SendConf send(boolean useMmsRadio, boolean useProxyIfAvailable)  throws IOException {
  byte[] response = sendBytes(useMmsRadio, useProxyIfAvailable);
  return (SendConf) new PduParser(response).parse();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:5,代码来源:OutgoingMmsConnection.java


示例14: sendLollipop

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private static SendConf sendLollipop(Context context, @NonNull byte[] pduBytes, int subscriptionId)
  throws UndeliverableMessageException
{
  Log.w(TAG, "Sending via Lollipop API");
  return new OutgoingLollipopMmsConnection(context).send(pduBytes, subscriptionId);
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:7,代码来源:CompatMmsConnection.java


示例15: sendLegacy

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private static SendConf sendLegacy(Context context, @NonNull byte[] pduBytes, int subscriptionId)
  throws UndeliverableMessageException, ApnUnavailableException
{
  Log.w(TAG, "Sending via legacy connection");
  return new OutgoingLegacyMmsConnection(context).send(pduBytes, subscriptionId);
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:7,代码来源:CompatMmsConnection.java


示例16: isInconsistentResponse

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
private boolean isInconsistentResponse(SendReq message, SendConf response) {
  Log.w("MmsTransport", "Comparing: " + Hex.toString(message.getTransactionId()));
  Log.w("MmsTransport", "With:      " + Hex.toString(response.getTransactionId()));
  return !Arrays.equals(message.getTransactionId(), response.getTransactionId());
}
 
开发者ID:Securecom,项目名称:Securecom-Text,代码行数:6,代码来源:MmsTransport.java


示例17: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Nullable SendConf send(@NonNull byte[] pduBytes, int subscriptionId) throws UndeliverableMessageException; 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:2,代码来源:OutgoingMmsConnection.java


示例18: send

import ws.com.google.android.mms.pdu.SendConf; //导入依赖的package包/类
@Nullable SendConf send(@NonNull byte[] pduBytes) throws UndeliverableMessageException; 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:2,代码来源:OutgoingMmsConnection.java



注:本文中的ws.com.google.android.mms.pdu.SendConf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextStream类代码示例发布时间:2022-05-22
下一篇:
Java ConfigResource类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap