The MMS operation on the MMS (Multimedia Messaging Service) in Android is related to the MMS protocol, which is completed through the API provided in frameworks: COM. google. android. the MMS package is not open in the SDK and can only be used by internal programs. It encapsulates all the APIS required by MMS.
This package is the implementation of the MMS protocol in Android, including some data structures: genericpdu, multimediamessagepdu, sendreq, sendconf, icationicationind, retrieveconf, pduheaders, pdubody, and pdupart. It also includes classes that operate on the data: pdupersister, pduparser, and pducomposer. Pdupersister is mainly used by Android applications. pduparser and pducomposer involve PDU-related protocols, it may affect mmsc or other platforms (for example, whether the packaged byte stream meets the standard or whether it can be successfully parsed and identified by other platforms)
The function of this package is to package multimedia data into PDU data that can be recognized by the standard mmsc during sending, and parse the PDU data packets during receiving for more convenient application use, it also provides some storage interfaces, such as saving the PDU to the database and loading the PDU from the database.
Class |
Purpose |
Pdupersister |
Used to manage PDU Storage |
Pduparser |
Used to parse PDU |
Pducomposer |
Used to generate PDU |
Pdupersister: used to manage PDU storage. Key Methods:
Return
|
Method
|
Description
|
Pdupersister
|
Getpdupersister (context)
|
Get the object
|
Uri
|
Persist (genericpdu, Uri)
|
Saves a genericpdu to the database specified by the URI, and returns the URI pointing to the newly generated data.
|
Genericpdu
|
Load (URI)
|
Load the data in the URI into a genericpdu object from the database.
|
Uri
|
Move (Uri, Uri)
|
Move the PDU from one place to another, for example, from the draft box to the sender, when the MMS has been sent.
|
Why do we need to encapsulate PDU storage into pdupersister? Because PDUS are stored in standard sqlitedatabase through telephonyprovider, and sqlitedatabase cannot store PDUS in byte streams directly, you must split PDUS into readable fields, therefore, the processing of PDU data is involved in the process of storing PDUS and loading PDUS from the storage. Therefore, it is encapsulated to make it easier to use.
Pduparser: Used to parse the PDU byte stream into a recognizable genericpdu for Android
Return |
Method |
Description |
Pduparser |
Pduparser (byte []) |
Construct an object |
Genericpdu |
Parse () |
Parse the PDU byte stream into Android PDU genericpdu |
Pducomposer: Package genericpdu to generate a PDU byte stream
Return |
Method |
Description |
Pducomposer |
Pducomposer (context, genericpdu) |
Construct an object |
Byte [] |
Make () |
Transfer the genericpdu into a PDU byte stream |