Skip to content

Commit 0b48e81

Browse files
committed
some fix
1 parent 4acc0fd commit 0b48e81

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ dependencies {
7272
androidTestImplementation deps.espresso
7373

7474
implementation project(path: ':mqtt')
75-
// implementation 'com.github.shiyinghan:MqttAndroid:1.0.0'
75+
// implementation 'com.github.shiyinghan:MqttAndroid:1.0.1'
7676
}

mqtt/proguard-rules.pro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@
1515
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1616
# public *;
1717
#}
18-
19-
-keep class org.eclipse.paho.client.mqttv3.internal.* { *; }
20-
-keep class org.eclipse.paho.client.mqttv3.spi.* { *; }

mqtt/src/main/java/com/shiyinghan/mqtt/android/service/AlarmPingSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @see MqttPingSender
2929
*/
30-
class AlarmPingSender implements MqttPingSender {
30+
public class AlarmPingSender implements MqttPingSender {
3131
// Identifier for Intents, log messages, etc..
3232
private static final String TAG = AlarmPingSender.class.getSimpleName();
3333

mqtt/src/main/java/com/shiyinghan/mqtt/android/service/MqttAndroidClient.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,11 @@ public void onFailure(IMqttToken asyncActionToken, Throwable throwable) {
350350
}
351351
};
352352

353+
// if myClient is null, then create a new connection
353354
if (myClient == null) {
354-
// if myClient is null, then create a new connection
355-
alarmPingSender = new AlarmPingSender(mqttService);
355+
if (alarmPingSender == null) {
356+
alarmPingSender = new AlarmPingSender(mqttService);
357+
}
356358
myClient = new MqttAsyncClient(serverURI, clientId, persistence, alarmPingSender);
357359
myClient.setCallback(new MqttCallbackExtendedAndroid());
358360
}
@@ -1724,6 +1726,10 @@ private void releaseWakeLock() {
17241726
}
17251727
}
17261728

1729+
public void setAlarmPingSender(AlarmPingSender alarmPingSender) {
1730+
this.alarmPingSender = alarmPingSender;
1731+
}
1732+
17271733
/**
17281734
* identify the callback to be invoked when making tracing calls back into
17291735
* the Activity

0 commit comments

Comments
 (0)