使用onesignal向特定用户发送通知

问题描述:

我在项目中第一次使用 onesignal .我必须在某些事件上向特定用户(无论用户在chrome或android设备上登录的位置)发送通知,例如whatsapp也在移动设备和网站上发送通知,并且仅在用户登录时才发送.我已成功将通知发送给所有用户用户.在OneSignal上进行了一些研发之后,我知道我必须为此目的将通知发送到特定的playerId.但是,这是我的一些疑问/疑问.

I'm using onesignal for first time in my project. I have to send notification to specific users (wherever user is logged in either on chrome or android device) on some events like whatsapp sends notification on mobile as well as website too and only if user is logged in. I have successfully sent notification to all users. After some R&D on OneSignal, I come to know that I have to send notifications to specific playerId for this purpose. But here are some my questions/doubts.

  • 我认为播放器ID是设备ID.如果我是对的,那么如果当前用户注销而另一用户又在同一设备上登录该怎么办.我怎么知道我已经随着用户更改而不必在该玩家ID上发送通知.
  • 单个用户会有多个玩家编号吗?一种用于Chrome浏览器,一种用于iOS设备,一种用于Android等?
  • 我将如何获取用户的playerId以存储在我的数据库中.因为我必须使用服务器剩余API 来发送通知.
  • I think player Id is device id. If I'm right, what if current user logged out and another user gets logged in on same device. How can I come to know that I have not to send notification on this player Id as user is changed.
  • Will be there multiple playerIds for single user? One for chrome, one for iOS device, one for Android etc?
  • How I will get playerId of user to store in my database. Because I have to use server rest API to send notifications.

如果任何人都可以解释这些要点并描述在我的数据库中存储Playerid(何时和如何)的工作流程,将不胜感激.

If anyone can explain the points and also describe work flow to store playerid (when and how) in my database, it will be appreciated.

只需将playerIds存储到具有登录活动的数据库中即可.当他们注销时,只会触发与从数据库中删除玩家ID相关的查询.

Just store playerIds into database with login activity. when they logout just fire a query related to remove playerIds from database.