Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Least invasive way to uniquely identify Android user

How can you uniquely identify a user who has installed your app so that:

  1. You will know it is them if they delete and reinstall your app;
  2. You will know it is them if they install your app on a second device they intend to use simultaneously?

Just as an example, I see that the Netflix app will automatically link to your desktop account without any user interaction. I'm guessing that they use accountManager.getAccounts() or similar method, because they also require the GET_ACCOUNTS permission. But of course that permission is marked as Protection level: dangerous. Is there any technique to do this that is less invasive or potentially alarming?


The key to answering this is to be both simple (for the user) and minimally invasive. Android provides heaps of ways to identify users and many of those ways involve piercing a user's privacy, and if that is the only way, I will do what I do now (optional email registration). I just want a way for my app to know if a user already is registered in my system across installs without having to interview the user (username/password, email address, third-party OAuth, etc).

My main reasons are:

  1. I don't want support requests from users who orphaned their content after a reinstall; and
  2. I don't want to host lots of orphaned content.
like image 866
Andrew Avatar asked Feb 07 '17 04:02

Andrew


People also ask

How do I identify an Android phone uniquely?

UUID. randomUUID() method generates an unique identifier for a specific installation. You have just to store that value and your user will be identified at the next launch of your application. If you only target smartphones, you can take profit of the fact that the device have telephony services.

What is Android device ID?

The Android unique device ID is called the Android Advertising ID (AAID). It's an anonymized string of numbers and letters generated for the device upon initial setup. None of the user's personal information is included in an Android ID.

How to get device ID in Android programmatically java?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. In the above code, we have given runtime permission to read phone state, without phone state we can't get device id.

How can I get Android device ID?

To find your Android Device ID, there are two methods you can use. You can type in a special dialer sequence, *#*#8255#*#*, though this does not work on all devices. Alternatively, you can download a third-party Android app called Device ID to display this alphanumeric key, which works on all phones.


3 Answers

Have a look at Firebase Authentication. It's quite seamless and does not require much effort to incorporate. Also it does not feel intrusive or cumbersome to the end user.

Here is a video tutorial by Google.

EDIT: In case your users are sure to have a cellular device with a phone number, you can use AccountKit. It is also what they call OTA (One Time Authentication). AccountKit uses just the users phone number to verify and validate users.

EDIT: Firebase Authentication now features 'Phone Verification' which is similar to AccountKit mentioned above. Both are good services. However, Firebase phone verification lets you make your own UI from scratch (which means a lot better control than AccountKit). Also, if you don't want to make your UI, you can always use FirebaseUI

like image 162
Abdul Wasae Avatar answered Oct 18 '22 19:10

Abdul Wasae


i have implemented something that seems little similar to your thing by push notification , i can get error if user uninstalled my app(and from the registration id i get the user) , and if he re installed he obtain a new registration id , and try to get the user UUID for different devices

like image 25
Assem Mahrous Avatar answered Oct 18 '22 19:10

Assem Mahrous


I think the simplest way would be using UUID and storing the hash on sharedPreferences. You should generate the UUID as earlier as possible in your app.

sharedPrefs = context.getSharedPreferences(APP_SHARED_PREFS,Activity.MODE_PRIVATE);
if (sharedPrefs.getString("YOUR-KEY-TO-THE-UUID") == null || "".equals(sharedPrefs.getString("YOUR-KEY-TO-THE-UUID"))){
    prefsEditor = sharedPrefs.edit();
    prefsEditor.putString("YOUR-KEY-TO-THE-UUID", UUID.randomUUID().toString());
    prefsEditor.commit();
}
like image 3
danielpsantiago Avatar answered Oct 18 '22 21:10

danielpsantiago