Android MMS: The use of PDU detailed _android

Source: Internet
Author: User
Tags data structures
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.