"Go" Android get native number (collect)

Source: Internet
Author: User

SIM the data stored by the card can be divided into four categories :

The first class is fixed-storage data. This data is written by the SIM card center before the mobile phone is sold, including the International Mobile Subscriber Identification Number (IMSI), authentication key (KI), authentication and encryption algorithms, and so on.

The second type is temporary storage of data about the network. such as the location Area identification Code (LAI), mobile User temporary identification number (TMSI), prohibit access to the public telephone network code.

The third category is related business code, such as personal identification Number (PIN), unlock code (PUK), billing rate, etc.

The fourth category is the phone book, which is the phone number that mobile phone users enter at any time. All of the user information is stored in the SIM card, so the SIM card is also called the User Data identification card.

IMSI is a unique number that identifies the only user in the GSM and UMTS networks. It is stored in the SIM card of the phone and it is sent to the network via the phone. The IMSI is the only one that corresponds to SIM. Technically speaking, mobile phone number information is not stored on the SIM card, only IMSI (International Mobile Subscriber Identification numbers) will be stored. The mobile phone number (MSISDN) is registered in the HLR (Home location register), where IMSI and MSISDN are associated in HLR.

The IMEI is also a unique number that identifies the only mobile phone in the GSM and UMTS networks. It is usually printed on the side of the battery below the cell phone and dials * #06 # to see it. The IMEI corresponds to the device only.

1) The IMEI does not exist in the SIM card, it is the serial number of the phone itself.
2) Usually we call the mobile phone number also does not exist in the SIM card, although the SIM card has a special store SIM card itself, but this number is manually set, and can be changed. SIM card recognition usually uses the IMSI number, which is unique to the SIM card.
3) using functions such as simgetrecordinfo to get the IMSI number of a SIM card depends on whether the device manufacturer has implemented this function, as far as I know it is available on the Dopod machine, but not on the Lenovo machine, other machines are not.
4) The acquisition of IMEI and IMSI can be obtained by means of Ril or the line operation in TAPI.

Here is the code to get the phone's native number:

Telephonymanager TM = (Telephonymanager) this.getsystemservice (Context.telephony_service);

String DeviceID = Tm.getdeviceid ();

String Tel = tm.getline1number ();//Mobile number

String IMEI = Tm.getsimserialnumber ();

String IMSI = Tm.getsubscriberid ();

Add Permissions:

note that mobile phone numbers are not available for all. Just a part of it can get. This is due to the fact that the mobile operator does not write data from the mobile phone number to the SIM card. This is like a variable, and when the mobile operator assigns it a value, it will naturally have a value. No value is naturally empty. That's why many people don't get a native number.

Mobile phone numbers are not available for all. Just a part of it can get. This is due to the fact that the mobile operator does not write data from the mobile phone number to the SIM card. The SIM card only has the unique number, for the network and the device recognition that is the IMSI number, the cell phone signal also can say is passes through this number in the network, is not the mobile phone number. Just imagine, after your SIM card is lost, do you have a new one that will change the number? No, it is because the IMSI number that corresponds to your mobile phone number is modified in the mobile operator to the IMSI number of the new SIM card.
So why does the phone number have to show it?
This is like a variable, and when the mobile operator assigns it a value, it will naturally have a value. No value is naturally empty.
For mobile users, the mobile number (MDN) is saved in the operator's server instead of being stored in the SIM card. The SIM card retains only IMSI and some verification information. Every time the mobile network registration, will be in the form of text messages to the IMSI and authentication information to the operator's server, the server after the completion of the registration action, will be in the form of text messages will be issued to the mobile phone. The content will be different depending on the conditions.
If the server in the issued text message, does not include the phone number, the phone is unable to obtain the phone number. If the text contains a number, the phone will cache it for his use. In addition, for other operators ' SIM cards or Uim cards, the MDN may be saved in the UIM card. 100% being able to get a native number is unlikely.
Mobile Shenzhou Line, Unicom's card can be taken. The dynamic zone is not available. Other cards have not been tried yet.
The ability to read the SIM card number should have a precondition. That is, the SIM card has been written to the local number, otherwise it cannot be read.

A friend on the network proposed the following solution:

Send a text message to 10086, then get the sender's number in the Outbox ... Anyway, 10086 texting or calling is free, but you have to pay attention.
1. After obtaining the sender number in the Outbox, you must delete the record in the Outbox.
2, is you also want to intercept 10086 to you reply the text message, otherwise there will be a notification display above the screen, prompt 10086 sends a text message, lets you examine;
These are in order to get the task of the number of the machine, but at the same time improve the user experience degree ... Do you understand?

However , many people say that there is no recipient number in the text messages received, so you may not be able to get the phone number (not tested yet)

China Mobile SIM card only IMSI number and do not store mobile phone number, in China Mobile HLR there will be a mapping table, specifically for the user SIM card IMSI map to become the user's mobile phone number, this is the mobile lost card is not lost business is the reason for this, is also a principle of the number. and Telecommunications CDMA (formerly Unicom CDMA) card-in-the-same mobile card will be in the presence of IMSI and mobile phone number.


? Client access: In the client to mobile users can only obtain such as IMSI, IMEI number, etc., and can not directly obtain a mobile phone number. And for the telecom CDMA card-in-a user can get mobile phone number.
? server-side access: In the early mobile whitelist is able to obtain clear-text mobile phone number, the recent mobile strategy has changed, mobile phone number into a heavenly book-like unique serial number. So the current from the server side directly to get mobile phone number is also not.
The only way to think of a relatively reliable automatic acquisition of a user's mobile phone number is by means of a text message.
? by SMS: Let the user uplink a text message, through the SMS gateway to obtain the user's mobile phone number, thereby binding the user ID and the phone number

from:http://blog.csdn.net/aicpzl/article/details/51655133

"Go" Android get a native number (collect)

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.