MMS in Android to MMS (multimedia messaging Service) The operation of the MMS protocol is done through the APIs provided in frameworks: Com.google.android.mms This package is not open in the SDK and can only be used by internal programs, encapsulating 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,notificationind,retrieveconf, Pduheaders,pdubody,pdupart and so on. It also includes classes that manipulate the data: Pdupersister,pduparser and Pducomposer. Pdupersister is primarily for use within Android applications, while Pduparser and Pducomposer involve PDU-related protocols that interact with MMSC or other platforms (for example, if the packaged byte stream meets the standard, Can be successfully resolved and identified by other platforms, etc.)
The function of this package is to package the multimedia data into the PDU format data that the standard MMSC can recognize when sending. When received, the PDU packet is parsed for more convenient application, while also providing some storage interface, such as saving PDU to database and loading PDU from database.
Class |
Purpose |
Pdupersister |
For managing PDU Storage |
Pduparser |
For resolving PDUs |
Pducomposer |
For generating PDUs |
Pdupersister: The key approach to managing PDU storage is:
Return
|
Method
|
Description
|
Pdupersister
|
Getpdupersister (context)
|
Get the Object
|
Uri
|
Persist (GENERICPDU, Uri)
|
Saves a GENERICPDU to the database specified by the URI, returning the URI that points to the newly generated data
|
Genericpdu
|
Load (Uri)
|
To load the data that the URI refers to as a GENERICPDU object from the database
|
Uri
|
Move (URI, URI)
|
Move the PDU from one place to another, such as moving from a draft box to the Outbox, when MMS has been sent.
|
Why would you want to encapsulate the PDU's storage into pdupersister? Because the PDU is stored in a standard sqlitedatabase, through Telephonyprovider, and the storage in Sqlitedatabase cannot be stored with a direct PDU's byte stream, the PDU must be disassembled into readable fields, Therefore, in the process of storing PDU and loading PDU from storage, it involves the processing of the PDU data, so the encapsulation is more convenient to use.
Pduparser: Used to parse the PDU byte stream into an android recognizable GENERICPDU
| return
| method
Description |
Pduparser |
Pduparser (byte[]) |
Construct an Object |
Genericpdu |
Parse () |
Parse the PDU byte stream into the Android PDU GENERICPDU |
Pducomposer: GENERICPDU packaging to generate PDU byte stream
return |
method |
Description |
pducomposer |
pducomposer (context, GENERICPDU) |
construct an object |
byte[] |
make () |
Transfer the GENERICPDU into a PDU byte stream |