當接收一條多媒體訊息時,首先會從多媒體訊息中心收到一條push資訊,PushReciever.java的OnReceive()方法被觸發,接著會執行ReceivePushTask的doInbackground()方法,在該方法裡,會擷取raw push-pdu 資訊,解析並存入到資料庫中(pdu表)中。這時會把多媒體訊息的date欄位和expir欄位加到資料庫中,然後執行TransactionService服務。
NotificationTransaction.java類的run()方法負責從多媒體訊息中心下載多媒體訊息資訊
byte[] retrieveConfData = null;
// We should catch exceptions here to response MMSC
// with STATUS_DEFERRED.
try {
retrieveConfData = getPdu(mContentLocation);
} catch (IOException e) {
mTransactionState.setState(FAILED);
}
擷取到資料後,解析資料並存入資料庫中,然後刪除之前加入到資料庫中的那條記錄。
if (retrieveConfData != null) {
// BEGIN: 0001893 bggim@lge.com 2009-11-11
// MOD: 0001893: [MMS] Apply LGDRM code (From EVE)
//BEGIN : 0002820 byeonggeun.kim@lge.com 09-12-28
//ADD : 0002820: [MMS] Fix MMS time stamp bug
RetrieveConf pdu =(RetrieveConf) new PduParser(retrieveConfData).parse(mContext);
//END : 0002820 byeonggeun.kim@lge.com 09-12-28
// END: 0001893 bggim@lge.com 2009-11-11
if ((pdu == null) || (pdu.getMessageType() != MESSAGE_TYPE_RETRIEVE_CONF)) {
Log.e(TAG, "Invalid M-RETRIEVE.CONF PDU.");
mTransactionState.setState(FAILED);
status = STATUS_UNRECOGNIZED;
} else {
// Save the received PDU (must be a M-RETRIEVE.CONF).
PduPersister p = PduPersister.getPduPersister(mContext);
Log.e("xxxx", "Date ============== " + pdu.getDate());
Date now = new Date();
long l = now.getTime()/1000;
// pdu.setDate(System.currentTimeMillis());//add by chenrx
pdu.setDate(l);//add by chenrx
Log.e("xxxx", "Date ====modify======== " + pdu.getDate());
Uri uri = p.persist(pdu, Inbox.CONTENT_URI);
// We have successfully downloaded the new MM. Delete the
// M-NotifyResp.ind from Inbox.
SqliteWrapper.delete(mContext, mContext.getContentResolver(),
mUri, null, null);
// Notify observers with newly received MM.
mUri = uri;
status = STATUS_RETRIEVED;
}
}