Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 views
in Technique[技术] by (71.8m points)

push notification - Basic Steps for Using MQTT in android

I am new to Android and want to use MQTT as push notifier for Android from Server.
i have read about MQTT but does not understand well. if any one has used this library so plz tell me what i have to do to start using it..

i have a Java Server (Running on Windows) and lots of Client(android phones on which my app will be installed). My server will send message to all or some specific clients at any time.

what are my basic requirement ? i mean is there

  1. server requirement ?
  2. some sort of registration ?
  3. Library to include in android ?
  4. identifier for Android device ? (as C2DM require Google account for each device)

plz help me in this regard

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need:

  1. an MQTT broker which runs on the server side. This could be something like the mosquitto broker which is Open Source.
  2. an MQTT client library which you include in your Android app, enabling your app to connect, subscribe, and publish messages. There are a number of Java options listed at http://mqtt.org/software
  3. to come up with a way of uniquely identifying users or devices, and then use that as a topic so that you can individually publish a message to one device.

Dale Lane has written a nice guide on this (http://www.dalelane.co.uk/blog/?p=1599) and there is also a good set of resources about MQTT (https://github.com/mqtt/mqtt.github.io/wiki)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...