Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send Notification to specific user using onesignal

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.

  • 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.

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

like image 778
Akshay Vaghasiya Avatar asked Feb 04 '23 22:02

Akshay Vaghasiya


1 Answers

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

like image 110
Kishan Avatar answered Feb 08 '23 05:02

Kishan