Search in sources :

Example 1 with TransactionSettings

use of com.android.mms.transaction.TransactionSettings in project qksms by moezbhatti.

the class MmsReceivedReceiver method getNotificationTask.

private List<CommonAsyncTask> getNotificationTask(Context context, Intent intent, byte[] response) {
    if (response.length == 0) {
        Timber.v("MmsReceivedReceiver.sendNotification blank response");
        return null;
    }
    if (getMmscInfoForReceptionAck() == null) {
        Timber.v("No MMSC information set, so no notification tasks will be able to complete");
        return null;
    }
    final GenericPdu pdu = (new PduParser(response, new MmsConfig.Overridden(new MmsConfig(context), null).getSupportMmsContentDisposition())).parse();
    if (pdu == null || !(pdu instanceof RetrieveConf)) {
        Timber.e("MmsReceivedReceiver.sendNotification failed to parse pdu");
        return null;
    }
    try {
        final NotificationInd ind = getNotificationInd(context, intent);
        final MmscInformation mmsc = getMmscInfoForReceptionAck();
        final TransactionSettings transactionSettings = new TransactionSettings(mmsc.mmscUrl, mmsc.mmsProxy, mmsc.proxyPort);
        final List<CommonAsyncTask> responseTasks = new ArrayList<>();
        responseTasks.add(new AcknowledgeIndTask(context, ind, transactionSettings, (RetrieveConf) pdu));
        responseTasks.add(new NotifyRespTask(context, ind, transactionSettings));
        return responseTasks;
    } catch (MmsException e) {
        Timber.e(e, "error");
        return null;
    }
}
Also used : PduParser(com.google.android.mms.pdu_alt.PduParser) NotificationInd(com.google.android.mms.pdu_alt.NotificationInd) ArrayList(java.util.ArrayList) MmsException(com.google.android.mms.MmsException) MmsConfig(com.android.mms.service_alt.MmsConfig) TransactionSettings(com.android.mms.transaction.TransactionSettings) GenericPdu(com.google.android.mms.pdu_alt.GenericPdu) RetrieveConf(com.google.android.mms.pdu_alt.RetrieveConf)

Aggregations

MmsConfig (com.android.mms.service_alt.MmsConfig)1 TransactionSettings (com.android.mms.transaction.TransactionSettings)1 MmsException (com.google.android.mms.MmsException)1 GenericPdu (com.google.android.mms.pdu_alt.GenericPdu)1 NotificationInd (com.google.android.mms.pdu_alt.NotificationInd)1 PduParser (com.google.android.mms.pdu_alt.PduParser)1 RetrieveConf (com.google.android.mms.pdu_alt.RetrieveConf)1 ArrayList (java.util.ArrayList)1