Device Id

luke2012

Well-Known Member
Licensed User
Longtime User
Good morning Community!
In B4A how obtain the device ID ?
I mean a name/code that identify (Unique) the Android device within all others devices ?
 

salmander

Active Member
Licensed User
Longtime User
if its a GSM device (mobile phone), then you can get imei by;
B4X:
Dim pID As PhoneId
Dim imei As String

imei = pID.GetDeviceId
you need to enable Phone library in the Libs Tab.

For Non-GSM devices (tablets), you can either get "android_id" or mac address.
B4X:
Dim phn As Phone
Dim androidID As String
' For android_id
androidID = phn.getSettings("android_id")
 
Last edited:
Upvote 0
Top