Read The IMEI Device ID With Delphi XE5 Firemonkey On Android

Delphi XE5 Firemonkey Android IMEIHere is a code snippet which gets the Android device IMEI for you using the Android JNI. The IMEI (International Mobile Equipment Identity) is a unique device ID separate from your SIM card. Accessing the IMEI also requires that your app has the READ_PHONE_STATE permission to be able to access it. I’m not sure who wrote the original example code but on the Embarcadero forum Remy Lebeau posted this code snippet in October of 2013. Here is the full permission line for the Android manifest:

And here is the code snippet:

There are also two other blog posts with slightly different code for retrieving the IMEI on Android with Delphi XE5 Firemonkey here and here.

Head over to the Embercadero forum to read the full thread about getting the IMEI on Android.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

6 Responses to Read The IMEI Device ID With Delphi XE5 Firemonkey On Android

  1. Guilherme Lanius says:

    How can I do the same on IOS?

  2. Simon says:

    Thank you, this works perfectly.

  3. systemgvp says:

    Thank you, this works perfectly. I’ve use this for find getNetworkOperatorName and getSimSerialNumber, but I can find also in iOS?

    • Admin says:

      Apple has disallowed collecting the IMEI. Better off just generating a GUID and saving it for re-use in the app on IOS. Yes, you will lose it if they uninstall though.

  4. systemgvp says:

    I am creating an App for Public Administration who has the need to find legally on customers, there is some other information that I can find? or then give me an example similar to this article on something like that?

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Delphi XE5 Hotfix Updates Roundup And Unofficial IDE Patch

There have been six different hot fixes released for Delphi XE5 Firemonkey which correct a number of issues. Not all...