How to get the IMEI number in android and android get the imei number
1) within the Telephony Framework, you can directly use interfaces provided by GSM phone or GeminiPhone.
Versions earlier than KK:
IMEI (International Mobile Equipment Identity) is an International Mobile device Identity code. In the single-Card Project, a Mobile phone corresponds to an IMEI number, and in the dual-Card Project, a card corresponds to an IMEI number.
The following is the interface and demo code for obtaining the IMEI number.
API:
GetDeviceId () in GSMPhone. java ()
GetDeviceId () and getDeviceIdGemini () in GeminiPhone. java ()
Demo code:
Import com. android. internal. telephony. Phone;
Import com. android. internal. telephony. gemini. GeminiPhone;
Import com. android. internal. telephony. PhoneFactory;
Phone phone;
Phone = PhoneFactory. getDefaultPhone ();
String imei = (GeminiPhone) phone. getDeviceId ();
GeminiPhone mGeminiPhone;
String imei_sim1 = mGeminiPhone. getDeviceIdGemini (PhoneConstants. GEMINI_SIM_1 );
String imei_sim2 = mGeminiPhone. getDeviceIdGemini (PhoneConstants. GEMINI_SIM_2 );
KK version:
GetDeviceId () in GSMPhone. java ()
In GeminiPhone. java, getDeviceIdGemini () is no longer available, while getDeviceId () obtains the IMEI of the default phone;
Therefore, use the getDeviceId () method in GSMPhone. java;
Demo code:
GeminiPhone mGeminiPhone;
String imei_sim1 = mGeminiPhone. getPhonebyId (PhoneConstants. GEMINI_SIM_1). getDeviceId ();
String imei_sim2 = mGeminiPhone. getPhonebyId (PhoneConstants. GEMINI_SIM_2). getDeviceId ();
2) to obtain the IMEI number In SDK Development (third-party APK), use the getDeviceId () method in TelephonyManager or the getDeviceId (int simId) method in TelephonyManagerEx (dual-card interface.
Demo code (get the IMEI of DefaultPhone ):
Import android. telephony. TelephonyManager;
String imei_sim = TelephonyManager. getDeviceId ();
Demo code (dual-Card Interface ):
Import android. telephony. TelephonyManagerEx;
String imei_sim1 = TelephonyManagerEx. getDeviceId (PhoneConstants. GEMINI_SIM_1 );
String imei_sim2 = TelephonyManagerEx. getDeviceId (PhoneConstants. GEMINI_SIM_2 );
How to obtain the imei number of an android device
Java obtains the imei number permission of android and adds TelephonyManager telephonyManager = (TelephonyManager) this. getSystemService (Context. TELEPHONY_SERVICE); String IMEI = telephonyManager. getDeviceId (); adb command: adb shell dumpsys iphonesubinfo sometimes returns NULL because the module is powered off. After resetting, you need to turn on the module power to read out and view some system setting parameters of the machine. adb shell getprop
How to obtain the imei number of an android device
Java obtains the imei number permission of android and adds TelephonyManager telephonyManager = (TelephonyManager) this. getSystemService (Context. TELEPHONY_SERVICE); String IMEI = telephonyManager. getDeviceId (); adb command: adb shell dumpsys iphonesubinfo sometimes returns NULL because the module is powered off.