Firebase FCM token - When to send to server?

后端 未结 4 810
眼角桃花
眼角桃花 2020-12-31 04:19

Okay so I have an app which on first start takes you through a few welcoming slides, then takes you to a login/register page and then to MainActivity.

I

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 04:38

    We handled it like this:

    1. Our server create/update the token value against a user id (primary key)
    2. Use 2 SharedPreferences
      1. String - token String
      2. Boolean (updated) - whether token is updated on server or not.

    In case of token refresh we update the token string and set the boolean to false. Later whenever user login each time we check for boolean (updated), if that is false - we attach the current token to his id and send it to server and set updated to true.

提交回复
热议问题