stkvtflw
stkvtflw

Reputation: 13577

Unique identifier of Google Play Market / appstore user

Is there way to identify android/ios app user for sure without requesting him to signup with google/email/facebook?

I'd like to implement this: User downloads app from PlayMarket/AppStore, app identifies him somehow and sends data about this user to server. By "data about this user" i mean only the data gathered based on user's actions in app, like misc preferences and settings. If user will uninstall app and install it again to different device but with the same google account, he should be properly identified as the one who used the app before.

Upvotes: 1

Views: 984

Answers (1)

Tushar Monirul
Tushar Monirul

Reputation: 5064

in android you can collect the email address without asking the user if he/she logged in google account in the device:

Account account = getAccount(AccountManager.get(getApplicationContext()));

    if (account == null) {
        String accountName = "user did not provide email";
    } else {
        String accountName = account.name;
    }

public static Account getAccount(AccountManager accountManager) {
    Account[] accounts = accountManager.getAccountsByType("com.google");
    Account account;
    if (accounts.length > 0) {
        account = accounts[0];
    } else {
        account = null;
    }
    return account;
}

Another way, you can take the device id. But it wont fulfill you need if the user change the device and not logged in the google account. To get device id:

import android.provider.Settings.Secure;
String deviceId = Secure.getString(getContext().getContentResolver(),
                                                Secure.ANDROID_ID);

Upvotes: 1

Related Questions