Search code examples
androidoauth-2.0remember-meaccountmanager

How to remeber users without sign up in android?


Im working on a project where a user isn´t forced to sign up a account. My plan is that a user could do anything like a user that is registered except for a few exceptions. I implement a like function which saves the users behaviour on a webserver and later when the data is fetched again it recognized if the user liked something or not. My problem is that I have to save this informations also if the user isn´t registered to my application. A User should be free to decide wheter the user likes to sign up or not and isn´t forced to be a registered user. I found three different way that could work!

1. Option

First option would be the accountmanager but I don´t like this option at all cause I have to ask for the contact permission and also ask which account a user want to use.

2. Option

A other option would be if a user starts the app for the very first time the app would call a server which creates a random unique code and send that code to my application to save it as key for the users actions which is saved on a server. But that also doesn´t seems to be a good solution for my problem.

3. Option

The last option would be oauth but for now I don´t know if and how it would be the solution to my problem!

I would be thankful for every answer!


Solution

  • I have worked on a comic app that requires saving the user subscribed channels, genre or comics and save the likes/dislikes for the same. User can be subscribed to push notification too.

    For this, we used Firebase Authentication (anonymous signup). And to save the user subscription information, we used Firebase Firestore.

    And followed the below approach.

    • As soon as the app opens, check if the user has already anonymous SignIn. If it hasn't, signUp silently.
    • Add a listener for user push notification token change. And update it to Firestore by anonymous user-id as key (We did same for storing other information too).

    I think this approach would help to solve this problem.