0

I am developing an android application with user login and push notification facility.

So as per the documentation, I created a FCM account and created a database for saving access token.

user table

user_id   |    username
----------+---------------+
1         |   name 1      | 
2         |   name 2      |
--------------------------+

access token table

---------------------------------------+
id   |    user_id  |    access_token   |
-----+-------------+-------------------+
1    |    2        |   abfdfsfsdfsf    | 
2    |    2        |   abfdfsfsdfsf    |
-----+-------------+-------------------+

I just created separate table for access token because an user can login from any number of devices.

I am requesting and saving access token when the "user login" process.

So my questions are.

  1. I heard, when user clear the app data - then the generated access token will lost. Is it true ? If yes, in which process I need to save the access token ?

  2. Is there is any recommended method for saving the multiple access token against user ?

  3. Is there any limit in the notification send per day ?

Thanks in advance

ramesh
  • 4,008
  • 13
  • 72
  • 117

1 Answers1

2

1) Yes, clearing the data will lead to the Push ID token getting refreshed. No, this can't be avoided. (Access token is the wrong term to use as that is commonly used with OAuth2 libraries).

2) Recommended use for multi device user logins is Device Group Messaging and Topic Messaging.

You can read more about this here :Device Group messaging FCM

Topic messages are a bit easier to manage. I personally create a topic for each userid and for every login, subscribe the user to this topic. This eases sending notification to one user across all devices and also opens up the possibility of allowing other users to subscribe/follow other users and get notified of their activity. Your preference will however depend on what exactly you want to do.

3) There is currently no limit on the number of notifications you send daily or the number of topics that you can create.

Kushan
  • 5,855
  • 3
  • 31
  • 45