Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 577
Johni Deep Avatar asked Mar 05 '12 06:03

Johni Deep


People also ask

Which are the stages of MQTT?

An MQTT session is divided into four stages: connection, authentication, communication and termination.


1 Answers

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)

like image 89
Andy Piper Avatar answered Sep 29 '22 17:09

Andy Piper