Skip to content

Commit

Permalink
some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyinghan committed Apr 7, 2021
1 parent 2b630d5 commit d5dc646
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ The Mqtt Android Service is an MQTT client library for developing applications o
**Step 1.** Add it in your root **build.gradle** at the end of repositories:

```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

**Step 2.** Add the dependency:

```groovy
dependencies {
implementation 'com.github.shiyinghan:MqttAndroid:1.0.0'
}
implementation 'com.github.shiyinghan:MqttAndroid:1.0.0'
}
```

5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

<activity
android:name=".module.activity.ConnectionListActivity"
android:launchMode="singleTask">
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -31,9 +32,11 @@
</activity>
<activity
android:name=".module.activity.ConnectionEditActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".module.activity.ConnectionPortalActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
synchronized void notifyOffline() {
traceDebug(TAG, "Offline with client:" + getClientId() + '/' + getServerURI());

if (callback != null && !connectOptions.isCleanSession()) {
if (isConnected() && callback != null && !connectOptions.isCleanSession()) {
Exception e = new Exception("Android offline");
callback.connectionLost(e);
}
Expand Down

0 comments on commit d5dc646

Please sign in to comment.