- Home /
Question by
xwpedram_N · Nov 10, 2013 at 10:45 AM ·
android
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 .
Comment
Best Answer
Answer by Yury-Habets · Nov 19, 2013 at 09:09 AM
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 (http://developer.android.com/reference/android/os/Build.html#SERIAL).
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. $$anonymous$$y 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?