android4.x read SIM card SMS and contact related class instance analysis _android

Source: Internet
Author: User

This example describes the android4.x reading SIM card SMS and contact related classes. Share to everyone for your reference, specific as follows:

1. Iccsmsinterfacemanager

The main function of this class is two

<1> send SMS Data via Smsdispatcher
<2> Update and query SIM card SMS data

Iccsmsinterfacemanager is a binder service class, and the Binder interface is ISms.
Binder Service will be registered when Iccsmsinterfacemanager is created.
Iccsmsinterfacemanager is created in Phonproxy and holds the corresponding Phonebase object.
When reading the SMS data on the SIM card, it is read through the Phonebase Iccfilehandler, the Iccfilehandler calls the RIL object to send the command to the modem, the relevant code is as follows:

Fh.loadeflinearfixedall (iccconstants.ef_sms, response);

When you save the SMS data to the SIM card, it is through the Phonebase Ril object to operate, the Ril object sends the command to the modem. The relevant code is as follows:

if (phoneconstants.phone_type_gsm = = Mphone.getphonetype ()) {
 MPhone.mCi.writeSmsToSim (status, Iccutils.bytestohexstring (SMSC),
   iccutils.bytestohexstring (PDU), response);
else {
 MPhone.mCi.writeSmsToRuim (status, Iccutils.bytestohexstring (PDU),
   response);
}

2. Iccphonebookinterfacemanagerproxy

This class is primarily used to update and query contact data on the SIM card. It is the agent of the Iccphonebookinterfacemanager. Iccphonebookinterfacemanager is a binder service. Depending on the phonebase, Iccphonebookinterfacemanager has two implementation classes, Simphonebookinterfacemanager and Ruimphonebookinterfacemanager.iccphonebookinterfacemanager is constructed during the creation of Phonebase objects, and he holds a Phonebase object.

Iccphonebookinterfacemanagerproxy is constructed in the process of creating PhoneProxy objects. Iccphonebookinterfacemanagerproxy's creation process completes the registration of the Binder service Iccphonebookinterfacemanager and holds Iccphonebookinterfacemanager object.
Iccphonebookinterfacemanager holds a adnrecordcache. Object. This object comes from the iccrecords. Iccrecords from the Phonebase object. Phonebase updates the iccrecords of the corresponding SIM card by listening for the status of the Uicccontroller.

As you can understand, every time the SIM status changes, Uicccontroller first updates the status of the SIM card through uicccardapplication and updates the data read from the SIM card. Then, notify the Uicccontroller Listener (phonebase,icccardproxy) that the SIM card data has changed and they can update the data (iccrecords).

I hope this article will help you with the Android program.

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.