Hi again!
I found a new method on this site:
http://stackoverflow.com/questions/...-samsung-device-from-within-app-on-the-device
I translated it to B4A:
Sub GetManufacturerSerialNumber As String
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("ril.serialnumber"))
Return sn
End Sub
On Samsung S4 mini, it works perfectly (Android 4.2.2 and Android 4.4.4). But on a Nexus 7 (Android 6, no SIM module), it returns no serial number. Instead of, I can get the serial number via another method (static field):
Dim r1 As Reflector
Label7.Text = "Build.SERIAL: " & r1.GetStaticField("android.os.Build", "SERIAL" )
(This method was extracted from:
https://www.b4x.com/android/forum/t...ue-id-alternative-to-phoneid.14759/#post83638
)
This method (static field) returns a value on Samsung S4 mini too. But the value doesn't match with the serial number I found in the Android Settings. I don't know, what Kind of value this is.
On a LG 440 smart phone, GetManufacturerSerialNumber() Returns an empty string. The second method (static field) Returns a Long alphanumeric string, but the string doesn't match with the Serial#, which is printed on the backside of the phone. In the Android Settings, I couldn't find a Serial#. It seems, that there is no way, which return always and on every device the correct Serial#?! :-(
Does anybody has any ideas?
If you want, you can test GetManufacturerSerialNumber() on your device and post your results to this thread (with additional Information, what kind of device you are using, SIM module Y/N, Android Version)?
Thank you!
BR Wolfgang