0

我有一个在 prod 环境中运行的应用程序,最近我看到很多 RuntimExceptions for C2DM_REGISTERED 和 C2DM_ERROR。这确实令人沮丧,因为它会导致应用程序在生产环境中崩溃。我试图至少确定它是否是 worklight 本机 api 或我的应用程序中的错误,以便我可以着手进行修复。我们使用的是工作灯版本 6.0.0.20131129-1705。有关更多信息,我们正在设备上使用推送通知,它们工作正常。

这是两者的异常的堆栈跟踪:

java.lang.RuntimeException: Error receiving broadcast Intent 
{ act=com.x.y.z.C2DM_REGISTERED      
flg=3D0x10 (has extras) } in com.worklight.wlclient.api.WLPush$3@42c503e8
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:778)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5493)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit=
.java:1209)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Receiver not registered: com=
.worklight.wlclient.api.WLPush$3@42c503e8
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:667)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1758)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java=
:475)
at com.worklight.wlclient.api.WLPush$3.onReceive(WLPush.java:385)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:768)
... 9 more



java.lang.RuntimeException: Error receiving broadcast Intent 
{ act=x.y.z.C2DM_ERROR flg=3D0x10 (has extras) } in 
com.worklight.wlclient.api.WLPush$4@43253ff0
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:778)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5493)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit=
.java:1209)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Receiver not registered: com=
.worklight.wlclient.api.WLPush$3@43266650
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:667)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1758)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java=
:475)
at com.worklight.wlclient.api.WLPush$4.onReceive(WLPush.java:407)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:768)
... 9 more
4

1 回答 1

0

您忘记在AndroidManifest.xml.

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
于 2015-05-11T02:41:08.563 回答