6

I'm building Android application which needs to identify device by some unique number/string.

I've heard about ANDROID_ID but there are also reports that it can be the same on some phone models or even updates. Another thing is that it is recreated after factory reset or system reinstall. I can live with that although I would prefer if it stayed the same.

Is there another way to identify the phone without asking for more permissions? IMEI requires them(android.permission.READ_PHONE_STATE) but it can scare away users.

How Shazam does that? I know it identifies the phone permanently (it remembers that I was a user before it introduced 5 tags a month restriction for new users) even though I completely reinstalled the system.

Leonti
  • 10,400
  • 11
  • 43
  • 68

1 Answers1

0

Why not create a GUID in a file in a well-known location and have that be your unique identifier? That way you have full control and without the need for any elevated permissions (except for file system access.)

Paul Sasik
  • 79,492
  • 20
  • 149
  • 189
  • How would you persist the generated ID across software re-installs without basing the algorithm on a constant i.e. a device ID? – Error 454 Nov 30 '10 at 17:53
  • @error: The software installer would have to be smart enough to not reset the GUID file if it already exists. – Paul Sasik Nov 30 '10 at 17:54
  • 1
    I was thinking about that, but it would be almost the same as using ANDROID_ID (although it would solve the problem of same id across some devices). The bad thing is that after full system reinstall or factory reset it will be gone. I guess I have a choice - identifier for the current system installation or device id with elevating permissions. – Leonti Dec 02 '10 at 04:16
  • @Leonti: A thought crossed my mind: You must have accounted for the use case where an end-user loses a phone and gets a new one... and a new ID with it. Wouldn't a full reset/reinstall be a form of that case? Meaning that if you solve one, you solved the other. Users are going to lose phones and they will also reset them. IMO reset = lose and get new one. – Paul Sasik Dec 02 '10 at 18:20