I'm using Paho's MQTT client on my android application as service. When I try it on API 26 and above it is working without problem but subscribe is not working under that version.
mqttClient.subscribe(JOIN_TOPIC, 0).setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Log.d("Client Service", "Subscribe Success");
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
Log.d("Client Service", "Subscribe Failed");
}
});
I'm using genymotion to test and SDK debugging tool. API 26 enters to onSuccess method but API 25 doesn't. Publish method don't has any problem on both client.
mqttClient = new MqttAndroidClient(getApplicationContext(), serverUri, nickname);
MqttConnectOptions options = new MqttConnectOptions();
options.setCleanSession(true);
mqttToken = mqttClient.connect(options);
There is no problem with connection. It is connected with no problem. I just want to know why subscribe has that problem on API versions under 26.