use of com.google.android.mms.pdu.ReadRecInd in project android-aosp-mms by slvn.
the class MmsMessageSender method sendReadRec.
public static void sendReadRec(Context context, String to, String messageId, int status) {
EncodedStringValue[] sender = new EncodedStringValue[1];
sender[0] = new EncodedStringValue(to);
try {
final ReadRecInd readRec = new ReadRecInd(new EncodedStringValue(PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes()), messageId.getBytes(), PduHeaders.CURRENT_MMS_VERSION, status, sender);
readRec.setDate(System.currentTimeMillis() / 1000);
PduPersister.getPduPersister(context).persist(readRec, Mms.Outbox.CONTENT_URI, true, MessagingPreferenceActivity.getIsGroupMmsEnabled(context), null);
context.startService(new Intent(context, TransactionService.class));
} catch (InvalidHeaderValueException e) {
Log.e(TAG, "Invalide header value", e);
} catch (MmsException e) {
Log.e(TAG, "Persist message failed", e);
}
}
use of com.google.android.mms.pdu.ReadRecInd in project android-aosp-mms by slvn.
the class ReadRecTransaction method run.
public void run() {
PduPersister persister = PduPersister.getPduPersister(mContext);
try {
// Load M-read-rec.ind from outbox
ReadRecInd readRecInd = (ReadRecInd) persister.load(mReadReportURI);
// insert the 'from' address per spec
String lineNumber = MessageUtils.getLocalNumber();
readRecInd.setFrom(new EncodedStringValue(lineNumber));
// Pack M-read-rec.ind and send it
byte[] postingData = new PduComposer(mContext, readRecInd).make();
sendPdu(postingData);
Uri uri = persister.move(mReadReportURI, Sent.CONTENT_URI);
mTransactionState.setState(TransactionState.SUCCESS);
mTransactionState.setContentUri(uri);
} catch (IOException e) {
if (LOCAL_LOGV) {
Log.v(TAG, "Failed to send M-Read-Rec.Ind.", e);
}
} catch (MmsException e) {
if (LOCAL_LOGV) {
Log.v(TAG, "Failed to load message from Outbox.", e);
}
} catch (RuntimeException e) {
if (LOCAL_LOGV) {
Log.e(TAG, "Unexpected RuntimeException.", e);
}
} finally {
if (mTransactionState.getState() != TransactionState.SUCCESS) {
mTransactionState.setState(TransactionState.FAILED);
mTransactionState.setContentUri(mReadReportURI);
}
notifyObservers();
}
}
Aggregations