send LWT on release builds too

This commit is contained in:
Eric House 2022-01-10 20:50:15 -08:00
parent d9b1fb4df6
commit 25c85af2e6

View file

@ -271,9 +271,8 @@ public class MQTTUtils extends Thread implements IMqttActionListener, MqttCallba
// Last Will and Testimate is the way I can get the server notified of a
// closed connection.
private void addLWTIf( MqttConnectOptions mqttConnectOptions )
private void addLWT( MqttConnectOptions mqttConnectOptions )
{
if ( BuildConfig.DEBUG ) {
try {
JSONObject payload = new JSONObject();
payload.put( "devid", mDevID );
@ -282,8 +281,7 @@ public class MQTTUtils extends Thread implements IMqttActionListener, MqttCallba
// mqttConnectOptions.setKeepAliveInterval( 15 ); // seconds; for testing
} catch ( JSONException je ) {
Log.e( TAG, "addLWTIf() ex: %s", je );
}
Log.e( TAG, "addLWT() ex: %s", je );
}
}
@ -295,7 +293,7 @@ public class MQTTUtils extends Thread implements IMqttActionListener, MqttCallba
mqttConnectOptions.setCleanSession(false);
mqttConnectOptions.setUserName("xwuser");
mqttConnectOptions.setPassword("xw4r0cks".toCharArray());
addLWTIf( mqttConnectOptions );
addLWT( mqttConnectOptions );
try {
setState( State.CONNECTING );