Search in sources :

Example 1 with GenericPdu

use of ws.com.google.android.mms.pdu.GenericPdu in project Signal-Android by WhisperSystems.

the class MmsReceiveJob method onRun.

@Override
public void onRun() {
    if (data == null) {
        Log.w(TAG, "Received NULL pdu, ignoring...");
        return;
    }
    PduParser parser = new PduParser(data);
    GenericPdu pdu = null;
    try {
        pdu = parser.parse();
    } catch (RuntimeException e) {
        Log.w(TAG, e);
    }
    if (isNotification(pdu) && !isBlocked(pdu)) {
        MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
        Pair<Long, Long> messageAndThreadId = database.insertMessageInbox((NotificationInd) pdu, subscriptionId);
        Log.w(TAG, "Inserted received MMS notification...");
        ApplicationContext.getInstance(context).getJobManager().add(new MmsDownloadJob(context, messageAndThreadId.first, messageAndThreadId.second, true));
    } else if (isNotification(pdu)) {
        Log.w(TAG, "*** Received blocked MMS, ignoring...");
    }
}
Also used : PduParser(ws.com.google.android.mms.pdu.PduParser) GenericPdu(ws.com.google.android.mms.pdu.GenericPdu) MmsDatabase(org.thoughtcrime.securesms.database.MmsDatabase)

Aggregations

MmsDatabase (org.thoughtcrime.securesms.database.MmsDatabase)1 GenericPdu (ws.com.google.android.mms.pdu.GenericPdu)1 PduParser (ws.com.google.android.mms.pdu.PduParser)1