i have he following LWT topic
and WT message
private final String WILL_TOPIC = "sensor_0_LWT";
private final String WILL_MSG = "LWT: Unexpected Connection Drop Down";
And i am subscribed to a topic
named sensor_0
when I publish a message I receive it, but when I urn the WiFi off and turn it on again I expect o see the LWT messahe
I set in the connection options, but what happens is that i do not receive it.
why i do not receive the LWT
message when I reconnect?
Code:
final MqttClientPersistence persistenceDataDir = new
MqttDefaultFilePersistence(folder.toString());
final MqttAndroidClient client_1 = new MqttAndroidClient(getApplicationContext(), serverURI,
clientID, persistenceDataDir, Ack.AUTO_ACK);
MqttConnectOptions opts = new MqttConnectOptions();
opts.setCleanSession(false);
opts.setWill(WILL_TOPIC, WILL_MSG.getBytes(), 1, true);
opts.setKeepAliveInterval(keepAliveInterval);