I. sending MMS:
MMS is much more troublesome than SMS. It can be seen from the parameters of the sendmmsworker function: (Conv, mmsuri, persister, slideshow, sendreq) Context, Uri, pdupersister (PDU is used for MMS ), slideshow contains all the MMS information. sendreq contains headers for mime encapsulation of MMS, as well as from and to information.
(1) function sendmmsworker:
private void sendMmsWorker(Conversation conv, Uri mmsUri, PduPersister persister, SlideshowModel slideshow, SendReq sendReq) { .....}
There was a long piece of code before, and there was no unsent information before checking the conversation. Messagestatuslistener, which is defined in workingmessage. java, and the implementation is in composemessageactivity. java, so the former can easily call some functions of the latter when the status changes. Messagestatuslistener mainly includes: onprotocolchanged mms sms switching, onattachmentchanged attachments, onpremessagesent before sending messages, onmessagesent after sending messages. Here the onpremessagesent listening function is called, and composemessageactivity will call the resetmessage function, which will adjust the display, focus, and soft keyboard.
Check mmsuri. If this URI is empty, create a new URI to continue sending. The createdraftmmsmessage (persister, sendreq, slideshow) function can contain all the information required for sending. If the URI is not empty, updatedraftmmsmessage (mmsuri, persister, slideshow, sendreq) is called ); in short, the function is to save the MMS to the disk, that is, to save the draft.
Deletedraftsmessage delete draft
Create an mmsmessagesender and use this sender to call the sendmessage function.
If the return value of the function indicates that the sent message is actually an SMS. So we need to delete the draft stored in the database.
Call the onmessagesent listening function and call the onmessagesent of composemessageactivity. This function re-displays the conversationlist.
(2) createdraftmmsmessage (persister, sendreq, slideshow); and updatedraftmmsmessage (mmsuri, persister, slideshow, sendreq); these two functions are essentially the same, save the attachments in the form of pdubody, and update the URI.
3) mmsmessagesender. Java class, which implements the messagesender interface under MMS/transaction. This interface sendmessage and returns a Boolean value. If MMS is sent, true is returned. If SMS is sent, false is returned.
Figure 1.1 shows the sequence of sending a single-card mobile phone MMS Message
Figure 1.5 shows the sequence of Two-card mobile phone MMS messages:
Ii. Receiving MMS
Figure 1.3 shows the sequence of receiving MMS messages: