I have the method well implemented to extract the imei in my application. The issue is that it shows me the imei: 52b3f8b114ff321f and what I need is the numeric format like 35232143423546.
I have the method well implemented to extract the imei in my application. The issue is that it shows me the imei: 52b3f8b114ff321f and what I need is the numeric format like 35232143423546.
Try using the getDeviceId () method of the TelephonyManager class, which returns a String with the IMEI for the GSM network. Do not forget to declare in the Manifiest the permission to be able to read the telephone information.
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
I leave a link to the android documentation to know about the TelephonyManager class .
An example to implement outside the main thread:
public String obtenerIMEI(Context context){
TelephonyManager tm = (TelephonyManager)context.getSystemService(TELEPHONY_SERVICE);
return tm.getImei();
}
This function returns a String with the IMEI and it would be called like this:
obtenerIMEI(getApplicationContext());