Reputation: 689
How can I validate an id that is retrieved via Secure.ANDROID_ID in php?
I'm writing the server side of an app that uses them but want to make sure that requests that include invalid/fake Android IDs don't get responses.
Upvotes: 5
Views: 4075
Reputation: 18348
This is a very complicated issue right now on Android, it sucks that the Android team couldnt come up with something similar to a BlackBerry PIN to be able to identify devices in a fail-safe (nothing is ever fail safe, I know, but at least fail safe for a while) way.
There is a lot of discussion here on how to achieve what you want, I personally worked this out working based on this document, and this question (second answer, the one that starts with "There are many answers to this question, most of which will only work "some" of the time, and unfortunately that's not good enough.")
Upvotes: 0
Reputation: 15679
you could't rely on an Android ID nor validate it. At least not since the guys from XDA are able to change it on a device to a random number. I think there is no other way than generating Id's on the server side and store them inside your app to verify
Upvotes: 0
Reputation: 4096
You can't. The ANDROID_ID is simply a number that's randomly generated on the first boot of the device. There's absolutely nothing else that can be determined from the value.
Upvotes: 6