Support Topics Documentation Slack YouTube Blog

Getting deviceId by user


Using Java/Android, given a User object, how can I get the deviceId to send a message to specific device?

Hi @Maria_Kudriashova!

After you register the device and log in the user, the DeviceRegistration entry will have the relation to the Users table. If you have the user objectId, you can find the necessary DeviceRegistration entry (that also contains deviceId) with the following whereClause:
user.objectId = 'USER-OBJECT-ID'

Best Regards,