Я добавил облачное сообщение firebase в приложение. Я вызываю метод в текущей активности при получении сообщения с данными. Способ включает в себя залповый почтовый запрос.
Ошибка ANR возникает только на устройствах Huawei. Я надеюсь, что есть кто-то, кто может дать мне идею для этого. Спасибо.
Стек ANR:
Input dispatching timed out (Waiting to send key event because the focused window has not finished processing all of the input events that were previously delivered to it. Outbound queue length: 0. Wait queue length: 2.)
"main" tid=1 Native
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 flags=1 obj=0x73056ad0 self=0x78122a3a00
| sysTid=20046 nice=-10 cgrp=default sched=0/0 handle=0x78171f79b0
| state=S schedstat=( 7479347944 793149495 9121 ) utm=657 stm=90 core=2 HZ=100
| stack=0x7fff6b9000-0x7fff6bb000 stackSize=8MB
| held mutexes=
#00 pc 0000000000069800 /system/lib64/libc.so (__epoll_pwait+8)
#01 pc 000000000001f6c0 /system/lib64/libc.so (epoll_pwait+48)
#02 pc 0000000000015c80 /system/lib64/libutils.so (_ZN7android6Looper9pollInnerEi+144)
#03 pc 0000000000015b68 /system/lib64/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+108)
#04 pc 000000000011a5dc /system/lib64/libandroid_runtime.so (???)
#05 pc 00000000002014ac /system/framework/arm64/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+140)
at android.os.MessageQueue.nativePollOnce (MessageQueue.java)
at android.os.MessageQueue.next (MessageQueue.java:379)
at android.os.Looper.loop (Looper.java:144)
at android.app.ActivityThread.main (ActivityThread.java:7523)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
Код Java: класс dEmptyOperation расширяется от AsyncTask. Метод refreshList включает в себя почтовый запрос залпа
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// .. if statement codes
new dEmptyOperation() {
@Override
protected String doInBackground(String... params) {
if (main.refreshActivity != null) {
try {
main.refreshActivity.refreshList();
main.refresh = false;
}catch (Exception ignored){
}
}
return null;
}
}.execute("");
//..
}