简体   繁体   English

android用mqtt推送通知

[英]android pushing notification with mqtt

客户端首次连接到服务器时,如何将信息从android设备保存到数据库,这样我就知道应该将通知推送到哪个设备?

First, there's a lot of great information about MQTT on Android on the MQTT.org wiki . 首先, MQTT.org Wiki上有很多有关Android上 MQTT的重要信息。

This question is less about Android or MQTT and more about uniquely identifying a client device, and managing data on the backend service. 这个问题与Android或MQTT无关,而与唯一标识客户端设备以及管理后端服务上的数据有关。 There's no single answer here, but your device's MQTT ClientID / identifier needs to be unique so eg you will want to generate an identifier on the client side which is unique before connecting to a broker. 这里没有唯一的答案,但是您设备的MQTT ClientID /标识符必须唯一,因此例如,您将需要在客户端上生成一个唯一的标识符,然后再连接到代理。 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. 最初配置新客户端时,请将这些信息存储到您选择的数据库中,以便您知道用于寻址单个设备的主题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM