Last active
September 23, 2018 12:59
-
-
Save amanjeetsingh150/d64cfc3fee628a08855a3bc96a12e12c 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
/** | |
* Used for subscribing to the topic. | |
*/ | |
private void subscribeToTopic() { | |
try { | |
mqttAndroidClient.subscribe(subscriptionTopic, 0, null, new IMqttActionListener() { | |
@Override | |
public void onSuccess(IMqttToken asyncActionToken) { | |
Log.w(TAG, "Subscribed!"); | |
} | |
@Override | |
public void onFailure(IMqttToken asyncActionToken, Throwable exception) { | |
Log.w(TAG, "Subscribed fail!"); | |
} | |
}); | |
} catch (MqttException ex) { | |
Log.e(TAG, "Exception whilst subscribing"); | |
ex.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment