How do I get the serial number (not the IMEI) of iOS and Android devices?

1

How to get the serial number of a mobile device?

I need the solution in delphi, firemonkey that works on both Android and iOS.

    
asked by anonymous 03.02.2015 / 12:41

2 answers

0

Android solution.

In Delphi I have no idea, but you can search the native android classes, as if it were in Java (I believe) and try to do something similar.

No java:

android.telephony.TelephonyManager.getDeviceId()

This code snippet will return a string with device ID (IMEI in GSM and MEID in CDMA).

For this to work, you must use the permission:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

For more details, click here !

    
08.02.2015 / 15:19
0

getDeviceId ()

  

Returns the unique device ID of a subscription, for example, the IMEI for GSM and the MEID for CDMA phones. Return null if device ID is not available.

Source: link

Note that this method is deprecated in API level 26.

To get the IMEI, on Android, you can try the method below:

 TelephonyManager tm = (TelephonyManager)
        getSystemService(this.TELEPHONY_SERVICE);
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        String imei = telephonyMgr.getImei();
 } else {
        String imei = telephonyMgr.getDeviceId();
 }

Note that in some cases, Device ID may change. Unlike IMEI, which is always unique.

    
24.05.2018 / 14:44