Android Question Phone unique ID

Sub7

Active Member
Licensed User
Longtime User
Hello i need a secure way to store the phone id that's running the my app, i've read this post:
http://www.b4x.com/android/forum/threads/14759/#content
but it seems that does not always works, how i can get a secure unique id? no matter in which way, for every phone should be assigned a unique id that will not change if the app is unistalled or files deleted.
I would generate a random value and then store it in a file but the user could delete the files or reinstall the app to bypass this.
My app run from skd 10 to sdk 18, also runs in tablets without phone functionality.
I own a micro social network with about 30k active users and i need an unique device id to ban/check users illegal activity, actually i only store the ip address but that's not enough.

Thank you so much.
 

NJDude

Expert
Licensed User
Longtime User
Your best bet is to save that information online, you could use a combination of Android_ID, MAC and any other field, when the user logs in you check if that user is in your "black list" and take the corresponding action.

There's no foolproof way, but it will definitely help.
 
Upvote 0

Sub7

Active Member
Licensed User
Longtime User

Hello, yes i store that on a remote db not on device.
you said any other field, for example?

For now i am using that, but still there's a chance to hit the random condition which would be pretty useless for the purpose.
B4X:
Sub GetDeviceId
phone_ID= r.GetStaticField("android.os.Build", "SERIAL")
If phone_ID.ToLowerCase = "unknown" Then
phone_ID= phone1.GetSettings("android_id")
Else If phone_ID = "" Then
phone_ID = Rnd(0x10000000, 0x7FFFFFFF)
End If
Log(phone_ID)
End Sub

thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…