Friday, July 26, 2013

[android-developers] Re: Can't always get unique identifier



On Wednesday, July 24, 2013 3:45:58 PM UTC-4, Tobiah wrote:
I needed to send an identifier to our server to identify
users as they use my application.  I first used the phone
number, but found that tablets without service had none.  So failing
getting a phone number, I did this:

android_id = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID);

But it seems now, that a handful of users, notably those using T-mobile,
have phones that will not yield the above ID.

So I was wondering whether there was some other unique identifier
I could use, or failing that, would like to here suggestions on
generating an identifier that would (almost?) never be a duplicate.

----

Seems to me that if you combine your two ideas you get something that should work for all devices.  Better to use than the phone number would be the IMEI (GSM) or  MEID (CDMA) of the device, and if it doesn't have one then go for the Secure.ANDROID_ID.

If this fails and you have to use one of the other suggestions on this thread and need to store the generated
ID somewhere then instead of storing it on the file system and requiring extra permission just put it in a shared preference.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate