How can get android device SN code in unity3d ?

How can get android device SN code in unity3d ? I try with

SystemInfo.deviceUniqueIdentifier.ToString()

I see more info but I can`t find my SN device code .

1 Answer

1

Hi,

If you really want the serial number, try this:

AndroidJavaObject jo = new AndroidJavaObject("android.os.Build");
string serial = jo.GetStatic<string>("SERIAL");

Available from API level 9 (Build  |  Android Developers).

Hi. TNX for your answer but I am new in unity. when I copy your code in javascrip file this cant identify "AndroidJavaObject" . plz help.

Sure. My sample was in C#, here it is in Javascript: var jo = new AndroidJavaObject("android.os.Build"); var serial = jo.GetStatic.<String>("SERIAL"); HTH

Hello, In android 10 this way doesn't work, this version must make request to the user to get the serial and the user accept. is there any way to do this?