我正在使用Android Studio在我的应用上调试推送通知(附加到真实设备)。我已经设置了一个断点来推送处理程序,然后我开始调试。但是,30-40秒后,由于ANR,我的应用程序总是被ActivityManager杀死。该应用程序显然没有响应,因为我正在调试它。在调试会话的中间,一切都消失了,我需要重新开始(我也有30秒左右的时间来调试下一次)。这非常不方便。
我已延长ParsePushBroadcastReceiver
并处理onReceive
方法中的推送。
这是Logcat输出:
07-01 12:00:54.586 2280-2321/system_process E/ActivityManager﹕ ANR in com.ulouder.ulouder
PID: 1270
Reason: Broadcast of Intent { act=com.parse.push.intent.RECEIVE flg=0x10 pkg=com.ulouder.ulouder cmp=com.ulouder.ulouder/com.ulouder.PushHandler (has extras) }
Load: 0.6 / 0.66 / 0.61
CPU usage from 45803ms to 0ms ago:
15% 2402/com.android.systemui: 12% user + 2.9% kernel / faults: 5 minor
14% 1894/surfaceflinger: 5.3% user + 9.2% kernel
0.8% 2280/system_server: 0.3% user + 0.4% kernel / faults: 97 minor
0.6% 1909/adbd: 0.1% user + 0.5% kernel
0.4% 28003/kworker/u:1: 0% user + 0.4% kernel
0.3% 309/kworker/0:0: 0% user + 0.3% kernel
0.4% 1628/kworker/0:1: 0% user + 0.4% kernel
0.3% 1066/kworker/u:2: 0% user + 0.3% kernel
0.1% 748/s3c-fb-vsync: 0% user + 0.1% kernel
0.1% 1270/com.ulouder.ulouder: 0.1% user + 0% kernel / faults: 5 minor
0.1% 1502/kworker/u:3: 0% user + 0.1% kernel
0.1% 2528/dhd_dpc: 0% user + 0.1% kernel
0% 968/com.google.android.googlequicksearchbox:search: 0% user + 0% kernel / faults: 18 minor
0% 2660/wpa_supplicant: 0% user + 0% kernel
0% 29958/com.facebook.katana: 0% user + 0% kernel / faults: 58 minor
0% 1895/zygote: 0% user + 0% kernel / faults: 85 minor
0% 2545/com.google.android.gms.persistent: 0% user + 0% kernel
0% 7/watchdog/0: 0% user + 0% kernel
0% 433/kworker/2:1: 0% user + 0% kernel
0% 1111/mmcqd/0: 0% user + 0% kernel
0% 1342/com.google.android.apps.magazines: 0% user + 0% kernel / faults: 19 minor
0% 2527/dhd_watchdog_th: 0% user + 0% kernel
0% 2563/com.android.phone: 0% user + 0% kernel / faults: 1 minor
0% 2872/com.google.android.gms: 0% user + 0% kernel
9.3% TOTAL: 5.3% user + 4% kernel + 0% iowait + 0% softirq
CPU usage from 3199ms to 3716ms later:
80% 1733/app_process: 65% user + 15% kernel / faults: 8231 minor
75% 1733/app_process: 61% user + 13% kernel
+0% 1734/ReferenceQueueD: 0% user + 0% kernel
+0% 1735/FinalizerDaemon: 0% user + 0% kernel
+0% 1736/FinalizerWatchd: 0% user + 0% kernel
+0% 1737/GC: 0% user + 0% kernel
+0% 1738/Signal Catcher: 0% user + 0% kernel
+0% 1739/JDWP: 0% user + 0% kernel
+0% 1740/Compiler: 0% user + 0% kernel
+0% 1741/Binder_1: 0% user + 0% kernel
+0% 1742/Binder_2: 0% user + 0% kernel
29% 2280/system_server: 18% user + 11% kernel / faults: 206 minor
20% 2329/PackageManager: 18% user + 1.8% kernel
7.4% 2321/ActivityManager: 0% user + 7.4% kernel
1.8% 2624/Binder_9: 0% user + 1.8% kernel
5.5% 831/com.android.defcontainer: 1.1% user + 4.4% kernel / faults: 223 minor
3.3% 843/Binder_1: 0% user + 3.3% kernel
+0% 1743/IntentService[D: 0% user + 0% kernel
1.1% 1284/logcat: 0% user + 1.1% kernel
1.1% 1628/kworker/0:1: 0% user + 1.1% kernel
1.8% 1909/adbd: 0% user + 1.8% kernel
1.8% 1909/adbd: 0% user + 1.8% kernel
37% TOTAL: 28% user + 8.4% kernel
如何防止此行为?