Created
January 20, 2018 03:53
-
-
Save beersheba/cf74a3027e3cede9f05d735395563649 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
private void subscribe() { | |
String subscribeTopic = "inbox"; | |
try { | |
client.subscribe(subscribeTopic, 0, new IMqttMessageListener() { | |
@Override | |
public void messageArrived(final String topic, final MqttMessage message) throws Exception { | |
runOnUiThread(new Runnable() { | |
@Override | |
public void run() { | |
Toast.makeText(MainActivity.this, message.toString(), Toast.LENGTH_SHORT).show(); | |
} | |
}); | |
} | |
}); | |
} catch (MqttException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment