2个用户使用相同的设备和相同的应用程序,但登录ID不同-他们是否具有不同的gcm注册ID? [英] 2 users using same device and same app but different login id -do they have different gcm registration id?

查看:103
本文介绍了2个用户使用相同的设备和相同的应用程序,但登录ID不同-他们是否具有不同的gcm注册ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用user_id(基于email-id的唯一sno)和每个用户的GCM_id创建了表格.我有2个问题,

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. 两个具有不同email_id的用户可以从同一设备登录并接收gcm w.r.t该用户吗?

  1. Can 2 users with different email_id login from the same device and receive gcm w.r.t that user?

如何在数据库中创建和维护列.如果用户已在不同设备(移动设备,tab-Android)上安装了相同的email_id,则我需要哪些列才能使gcm工作?

How do I create and maintain columns in my database.Basically what are the columns I need for getting gcm working if user has installed app on different devices(Mobile,tab-Android) but same email_id ?

我指的是Android Hive链接,但有人说它的gcm(2012)已弃用. http: //www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

I was referring to Android Hive link but someone said that its gcm(2012) and is deprecated. http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

摘要: 要使最新的GCM在多个设备上正常工作,我需要采取哪些步骤? 谢谢. 非常感谢您的帮助.谢谢.

Summary: What are the steps I need to take to make latest GCM work properly on multiple devices? Thanks. I really appreciate any help .Thanks in Advance.

推荐答案

您在给定设备上的应用将具有一个注册ID.您想要将该注册ID与当前登录用户的用户ID关联.因此,当用户登录时,您应该将用户ID +注册ID发送到服务器,并将其存储在表中.用户注销后,应将用户ID发送到服务器,并在数据库中清除该用户的注册ID.

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.

现在,如果要为同一用户支持多个设备,则需要表.一个用于用户ID的表(其中用户ID是唯一的,并且可能是主键),另一个用于用户ID与注册ID关联的表(每个用户可以与多个注册ID关联).再次,在登录期间创建用户ID-注册ID关联,并在注销期间删除该关联.

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.

这篇关于2个用户使用相同的设备和相同的应用程序,但登录ID不同-他们是否具有不同的gcm注册ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆