How to get Phoneid through SubID?

Source: Internet
Author: User

A data table is used in Androidl to save SIM card information: There is a table in telephony.db that records the SIM card information, Siminfo:

CREATE TABLE siminfo (_id integer PRIMARY KEY autoincrement,icc_id TEXT not null,sim_id INTEGER default-1,display_name TEX T,carrier_name text,name_source integer default 0,color integer default 0,number text,display_number_format integer not N ULL default 1,data_roaming integer default 0,MCC integer default 0,MNC integer default 0);

A single row of record instances is as follows:

INSERT into "Siminfo" VALUES (1, ' 89860114831010865147 ', 0, ' China Unicom ', ' China Unicom 3G ', 0,-16746133, ' +8618516657794 ', 1,0,460,1);

Where the primary key _id is similar to the ID of the SIM card, the value is incremented from 1, sim_id is similar to the slot ID, in the dual-SIM version generally only -1/0/1 three values; the rest of the properties are well understood.

So how to correspond to _id and sim_id? such as functions:
Subscriptioncontroller.getphoneid (SUBID)://According to SUBID acquisition Phoneid
foreach Entry:mSlotIdxToSubId.entrySet ()//specific code, traversing Mslotidxtosubid
int sim = Entry.getkey (); Corresponds to the sim_id field in the Siminfo table
int sub = Entry.getvalue (); Corresponds to the _id field in the Siminfo table
if (subId = = Sub) {return sim;}//Normal process, the value returned here will be as Phoneid;

This means that the passed-in parameter SubID value equals the _id value of a row sim in the Siminfo table, returning its sim_id field, which represents the phone ID.


You can refer to the elements in mslotidxtosubid that are populated like this:

Mslotidxtosubid.put (SlotID, subId); Slotid:the slot which the SIM is inserted; Subid:siminfo table in the _id field, an example:

_id = 3
icc_id = 89860114831010865147
sim_id = 1

How to get Phoneid through SubID?

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.