- Home /
SystemInfo.deviceUniqueIdentifier returns IMEI on Android?
After searching the Unity forums and Unity Answers, I've seen a few people mention that SystemInfo.deviceUniqueIdentifier returns the IMEI of an Android device. I haven't yet seen any official confirmation from Unity Technologies on this (continuing to look).
I need to add an ad network's conversion tracking logic to Unity 3.5 built Android app.
When I try using SystemInfo.deviceUniqueIdentifier in my C# class it returns a number in the following format:
51F30A87-BBFA-128F-E915-C92391D2F164
However, if I dial *#06# and press Call on my test HTC Inspire 4G, the phone tells me my IMEI number looks similar to this:
8127362567812635
The HTC Inspire 4G is running Android 2.3.3 and is currently working over WiFi, not hooked up to a cellular network of any kind. However, it still has a TelephonyManager since it used to be connected to an AT&T account.
Does anyone have any ideas? Am I missing something here?
At this point, I'm giving up on using Unity's SystemInfo.deviceUniqueIdentifier and turning to writing a Java plugin to grab it from Android natively.
Answer by googler · Apr 04, 2013 at 09:43 AM
The magic is that when using READ_PHONE_STATE permission IMEI returned, otherwise Android_ID
This info about Android_ID when no READ_PHONE_STATE used is confirmed?
How i can active this magic way (READ_PHONE_STATE) in mono because i don't know that and when i just use SystemInfo.deviceUniqueIdentifier, no result is happen :(
Answer by DSamson · Mar 23, 2019 at 01:01 PM
string IMEI = TM.Call("getDeviceId"); imeiNumber2.text = "2 " + IMEI;
As well add below line in your Androidmanifest.xml file. and your Androidmanifest.xml file must be at Assets-Plugins-Android-Androidmanifest.xml.
,
add above line in your Androidmanifest.xml file and your androidmanifest.xml file must be at Assets-Plugin-Android- Androidmanifest.xml
Your answer
Follow this Question
Related Questions
Show device info such as resolution, OS, GPU, etc... 1 Answer
how do I get a unique device id for an android device? 2 Answers
Unity networking - can't connect from other device. 1 Answer
Access AndroidTargetDevice (PlayerSettings) from code 1 Answer
Mobile aspect ratio and scaling - Use 16:10 or 16:9 base for full screen background ? 0 Answers