当前位置: 首页>>代码示例>>Java>>正文


Java SendConf类代码示例

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


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


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