How can I save information from an android device to a database when clients first connect to the server, so I can be aware of which device I should push notifications to?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, there’s a lot of great information about MQTT on Android on the MQTT.org wiki.
This question is less about Android or MQTT and more about uniquely identifying a client device, and managing data on the backend service. There’s no single answer here, but your device’s MQTT ClientID / identifier needs to be unique so e.g. you will want to generate an identifier on the client side which is unique before connecting to a broker. You probably want to establish a specific topic for push notifications to that device too. When initially provisioning a new client, squirrel that information away into a database of your choice so you know the topic to use to address an individual device.