0

I want to implement a trial feature on Android and would like to make it somewhat difficult to circumvent but it doesn't have to be perfect. I'm hoping Firebase can help with this. Do they somehow know things like the original install time of a user and is that kept across reinstalls?

Thanks.

Edit: Right now I'm thinking I could store the install time tied to ANDROID_ID and that might be good enough but if anyone has any suggestions of an better/easier way to do this please let me know.

casolorz
  • 8,486
  • 19
  • 93
  • 200

1 Answers1

0

On some cases, ANDROID_ID value might be null, so this is not a good practice. It doesn't guarantee a unique identifier for each users. If you want a unique ID (UID) on each users, you can use Firebase Authentication to get the user's UID. The UID will not be changed if user was authenticated, even when user signing-in on different devices. But, if user is not authenticated yet, the UID will be changed every users clear the app's data.

You can get users' UID when they already logged in:

FirebaseAuth auth = FirebaseAuth.getInstance();
FirebaseUser user = auth.getCurrentUser();
if (user != null){ // logged in
    String uid = user.getUid();
}
Anggrayudi H
  • 14,977
  • 11
  • 54
  • 87
  • I looked at Firebase authentication and my issue is that I don't want to bother the users with a login because there is no other functionality that will require a login and when I did a test with `signInAnonymously`, the UID changed on each reinstall. – casolorz May 10 '17 at 18:14
  • @casolorz, Same with you, I also facing this problem. I don't want to bother users with login. I did some research to track the users' installation for 2 weeks, read many articles, and I found nothing helped. `ANDROID_ID` for example, it's not really unique. I think this is the only way to keep track of users across installation, i.e. by login. I suggest you to set the login type as GMail, so that when login dialog appears, there's no password needed. We developers have no permission to get the Gmail used by users to install our apps. So I think this is the only way. – Anggrayudi H May 10 '17 at 20:16
  • This post claims `ANDROID_ID` is only broken under 2.2 http://stackoverflow.com/a/5626213/704836 – casolorz May 10 '17 at 21:17