Hi!
I need to find out the device-ID (serial-number of my android-device). On multiple forums, I found the following lines, which should deliver the information:
See also:
http://stackoverflow.com/questions/2322234/how-to-find-serial-number-of-android-device
http://www.coderzheaven.com/2011/07...ice-id-or-serial-number-of-an-android-device/
I converted this code into B4A. I'm getting a string (maybe hex-number?), but this string doesn't match with the string, which I can find in my android-settings (Options - Info - Status). The real device ID consists of letters and numbers (it is no hex-number!)
Do you know, how I can get the device-id (not IMEI!)?
Here is my source-code:
Thank you in advance!
BR Wolfgang
I need to find out the device-ID (serial-number of my android-device). On multiple forums, I found the following lines, which should deliver the information:
B4X:
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
serial_no = (String) get.invoke(c, "ro.serialno");
System.out.println("Device serial ID : " + serial_no);
} catch (Exception e) {
System.out.println("Some error occured : " + e.getMessage());
}
See also:
http://stackoverflow.com/questions/2322234/how-to-find-serial-number-of-android-device
http://www.coderzheaven.com/2011/07...ice-id-or-serial-number-of-an-android-device/
I converted this code into B4A. I'm getting a string (maybe hex-number?), but this string doesn't match with the string, which I can find in my android-settings (Options - Info - Status). The real device ID consists of letters and numbers (it is no hex-number!)
Do you know, how I can get the device-id (not IMEI!)?
Here is my source-code:
B4X:
Dim sn As String
Dim r As Reflector
Dim m As Object
Dim Types(1) As String
Types(0) = "java.lang.String"
r.target = r.CreateObject("android.os.SystemProperties")
m = r.GetMethod("get", Types)
sn = r.InvokeMethod(r.Target,m,Array("ro.serialno"))
Label3.Text = sn
Thank you in advance!
BR Wolfgang