Skip to content

Commit 11eb8e4

Browse files
author
Arief Nur Putranto
committed
fix ANR issue
1 parent 9b607de commit 11eb8e4

File tree

8 files changed

+28
-15
lines changed

8 files changed

+28
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Second, you need to add SDK dependencies inside your app .gradle. Then, you need
5454
```
5555
dependencies {
5656
...
57-
implementation 'com.qiscus.sdk:chat-core:1.7.1'
57+
implementation 'com.qiscus.sdk:chat-core:1.8.1'
5858
}
5959
```
6060

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ buildscript {
2121
google()
2222
}
2323
dependencies {
24-
classpath 'com.android.tools.build:gradle:8.0.0'
25-
classpath 'com.google.gms:google-services:4.3.15'
24+
classpath 'com.android.tools.build:gradle:8.5.0'
25+
classpath 'com.google.gms:google-services:4.4.2'
2626

2727
// NOTE: Do not place your application dependencies here; they belong
2828
// in the individual module build.gradle files

chat-core/src/main/java/com/qiscus/sdk/chat/core/service/QiscusNetworkCheckerJobService.java

+14-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
import android.os.Build;
2929
import androidx.annotation.RequiresApi;
3030

31+
import com.google.firebase.annotations.concurrent.Background;
3132
import com.qiscus.sdk.chat.core.QiscusCore;
3233
import com.qiscus.sdk.chat.core.event.QiscusUserEvent;
34+
import com.qiscus.sdk.chat.core.util.QiscusAndroidUtil;
3335
import com.qiscus.sdk.chat.core.util.QiscusErrorLogger;
3436
import com.qiscus.sdk.chat.core.util.QiscusLogger;
3537

@@ -114,9 +116,18 @@ public void onCreate() {
114116

115117
@Override
116118
public void onDestroy() {
117-
unregisterReceiver(networkStateReceiver);
118-
QiscusLogger.print(TAG, "onDestroy");
119-
EventBus.getDefault().unregister(this);
119+
QiscusAndroidUtil.runOnBackgroundThread(() -> {
120+
try {
121+
unregisterReceiver(networkStateReceiver);
122+
QiscusLogger.print(TAG, "onDestroy");
123+
EventBus.getDefault().unregister(this);
124+
}catch (IllegalArgumentException e) {
125+
// already unregistered
126+
}
127+
128+
});
129+
130+
120131
super.onDestroy();
121132
}
122133

chat-core/src/main/java/com/qiscus/sdk/chat/core/util/QiscusLogger.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ public static void print(String message) {
2121
}
2222

2323
public static void print(String tag, String message) {
24-
if (QiscusCore.getChatConfig().isEnableLog()) {
25-
Log.d(tag, message);
26-
}
24+
QiscusAndroidUtil.runOnBackgroundThread(() -> {
25+
if (QiscusCore.getChatConfig().isEnableLog()) {
26+
Log.d(tag, message);
27+
}
28+
});
2729
}
2830
}

dependencies.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ repositories {
3030
ext {
3131

3232
minSDKVersion = 21
33-
targetSDKVersion = 33
34-
compileSDKVersion = 33
33+
targetSDKVersion = 34
34+
compileSDKVersion = 34
3535

3636
versions = [
3737
support : "31.0.0",

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Secondly, you need to add SDK dependencies inside your app .gradle. Then, you ne
8080
```
8181
dependencies {
8282
...
83-
implementation 'com.qiscus.sdk:chat-core:1.7.1'
83+
implementation 'com.qiscus.sdk:chat-core:1.8.1'
8484
}
8585
```
8686

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ chatVersionPatch=0
4343
# === qiscus chat-core library version ===
4444
chatCoreVersionMajor=1
4545
chatCoreVersionMinor=8
46-
chatCoreVersionPatch=0
46+
chatCoreVersionPatch=1
4747

4848
# === qiscus default base url
4949
BASE_URL_SERVER="https://api.qiscus.com/"
@@ -59,7 +59,7 @@ android.useAndroidX=true
5959

6060
libraryGroupId=com.qiscus.sdk
6161
libraryArtifactId=chat-core
62-
libraryVersion=1.8.0
62+
libraryVersion=1.8.1
6363

6464
libraryGroupIdChat=com.qiscus.sdk
6565
libraryArtifactIdChat=chat
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Tue May 02 22:11:28 WIB 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)