2014-10-09 169 views
0

您好我開發了一個Worklight應用程序,它使用Bluemix IBM Push,當我收到通知時,如果應用程序已關閉,它可以正常工作並打開應用程序,但當應用程序以下錯誤打開應用程序崩潰。Worklight應用程序在接收推送通知時崩潰

10-09 18:13:00.676: E/AndroidRuntime(4665): FATAL EXCEPTION: main 
10-09 18:13:00.676: E/AndroidRuntime(4665): java.lang.ClassCastException: com.ibm.mobile.services.push.internal.InternalPushMessage cannot be cast to com.worklight.androidgap.push.GCMIntentService$Message 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at com.worklight.androidgap.plugin.Push.onNewIntent(Push.java:193) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at org.apache.cordova.PluginManager.onNewIntent(PluginManager.java:371) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at org.apache.cordova.CordovaWebView.onNewIntent(CordovaWebView.java:874) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at org.apache.cordova.CordovaActivity.onNewIntent(CordovaActivity.java:702) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1225) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2472) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.ActivityThread.performNewIntents(ActivityThread.java:2485) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2494) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.ActivityThread.access$1400(ActivityThread.java:165) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1444) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.os.Handler.dispatchMessage(Handler.java:107) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.os.Looper.loop(Looper.java:194) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at android.app.ActivityThread.main(ActivityThread.java:5391) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at java.lang.reflect.Method.invokeNative(Native Method) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at java.lang.reflect.Method.invoke(Method.java:525) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
10-09 18:13:00.676: E/AndroidRuntime(4665):  at dalvik.system.NativeStart.main(Native Method) 
10-09 18:13:00.677: D/WLClient(4665): WLClient$ActivityListener.onActivityPaused in WLClient.java:1155 :: on activity paused com.Techathon.Techathon . activity count = 0 
10-09 18:13:00.683: D/NONE(4665): Flush called 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): Logger$UncaughtExceptionHandler.uncaughtException in Logger.java:402 :: Uncaught Exception 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): java.lang.ClassCastException: com.ibm.mobile.services.push.internal.InternalPushMessage cannot be cast to com.worklight.androidgap.push.GCMIntentService$Message 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at com.worklight.androidgap.plugin.Push.onNewIntent(Push.java:193) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at org.apache.cordova.PluginManager.onNewIntent(PluginManager.java:371) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at org.apache.cordova.CordovaWebView.onNewIntent(CordovaWebView.java:874) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at org.apache.cordova.CordovaActivity.onNewIntent(CordovaActivity.java:702) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1225) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2472) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.ActivityThread.performNewIntents(ActivityThread.java:2485) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2494) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.ActivityThread.access$1400(ActivityThread.java:165) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1444) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.os.Handler.dispatchMessage(Handler.java:107) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.os.Looper.loop(Looper.java:194) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at android.app.ActivityThread.main(ActivityThread.java:5391) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at java.lang.reflect.Method.invokeNative(Native Method) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at java.lang.reflect.Method.invoke(Method.java:525) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
10-09 18:13:00.718: E/com.worklight.common.Logger$UncaughtExceptionHandler(4665): at dalvik.system.NativeStart.main(Native Method) 
10-09 18:13:02.586: I/Process(4665): Sending signal. PID: 4665 SIG: 9 

我已經安裝根據這裏提供的鏈接,我的環境http://mbaas-gettingstarted.ng.bluemix.net/hybrid

回答

1

您是否嘗試過修改的AndroidManifest.xml刪除對GCMIntentService引用?

您可能能夠註釋掉部分如下解釋: https://developer.ibm.com/answers/questions/19343/double-push-notifications/?smartspace=bluemix

這樣,你將只使用Bluemix推SDK迴應推送通知是。希望完全避免這個錯誤。

編輯:經過一番玩弄後,我發現Push插件是造成衝突的SDK的原因。在我將config.xml中的Worklight Push插件註釋掉後,該錯誤消失了。

評論這些線,然後再試一次:

<feature name="Push"> 
    <param name="android-package" value="com.worklight.androidgap.plugin.Push" /> 
</feature> 
相關問題