I understand how to get a deviceId and connect this to a user so that a push notification can be sent to that specific user. What I do not know how to do is how to differentiate a different user when more than one suer is using the same iOS device. When a user changes, the deviceId stored at Backendless does not change.
Therefore, if I were to search for a specific user and then use the deviceId associated with this user, in theory, I could be sending the notification to more than one user - any user who has logged into the application with on the same device. Is there a work around for this?
You can publish a push message for one device (or more) using the option:
deliveryOptions.pushSinglecast = [deviceId]
You can save the user’s deviceIds in the user property as one-to-many relation.
Yes this is true but if I’m concerned with something different. If more than one user logs into the same device, deviceId is associated with multiple users and the call to deviceId would send multiple push notifications. Is this not true?
Push notification is sent to DEVICE, not to USER.
That makes sense but presents a problem.
If more than one user has logged into the same device, push notifications will be sent to the device regardless of who is logged in. For example, if a messaging app were created, regardless of who is logged in, the device will receive the notification of a incoming message even if it’s not intended for the current logged in user.
Is there a way to work around this?
Hi Jon,
You can use messaging channels to send messages to concrete users or groups of users.
Thank you.