Last active
September 23, 2018 14:03
-
-
Save amanjeetsingh150/128b5b0a18c72903e16f81f43ba75f09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MQTTHelper mqttHelper = new MQTTHelper(getApplicationContext()); | |
mqttHelper.setCallback(new MqttCallbackExtended() { | |
@Override | |
public void connectComplete(boolean reconnect, String serverURI) { | |
Log.d(TAG, "URI " + serverURI); | |
} | |
@Override | |
public void connectionLost(Throwable cause) { | |
cause.printStackTrace(); | |
} | |
@Override | |
public void messageArrived(String topic, MqttMessage message) throws Exception { | |
String payload = new String(message.getPayload()); | |
LatLng currentLatLng = convertStringToLatLng(payload); | |
Log.d(TAG, topic + " " + currentLatLng); | |
latLngPublishRelay.accept(currentLatLng); | |
} | |
@Override | |
public void deliveryComplete(IMqttDeliveryToken token) { | |
Log.d(TAG, "Delivery complete"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment