2 users using same device and same app but different login id -do they have different gcm registration id?

后端 未结 1 771
一整个雨季
一整个雨季 2021-01-01 02:23

I have created table with user_id(unique sno based on email-id) and GCM_id of each user .There are 2 questions I have namely,

  1. Can 2 users with different ema

1条回答
  •  醉话见心
    2021-01-01 02:59

    Your app on a given device will have one registration ID. You want to associate that registration ID with the user ID of the current logged in user. So, when a user logs in, you should send to your server the user ID + registration ID and store them in your table. When a user logs out, you should send the user ID to your server and clear the registration ID for that user in your DB.

    Now, if you want to support multiple devices for the same user, you'll need to tables. One table for user IDs (in which user ID is unique, and is probably the primary key), and another table for the association of user IDs to registration IDs (in which each user may be associated to multiple registration IDs). Again, you create the user ID - registration ID association during login and delete the association during logout.

    0 讨论(0)
提交回复
热议问题