繁体   English   中英

IBM Worklight 5.0.6.1-Android通知未到达设备或模拟器

[英]IBM Worklight 5.0.6.1 - Android notification does not reach either device or emulator

我遵循了Push Notifications培训模块中给出的所有步骤以及此Stack Overflow问题中的步骤: IBM Worklight-Push Notifications功能在Android模拟器中不起作用

当我使用PushBackendEmulator或从URL调用PushAdapter过程message sent successfully ,它说message sent successfully ,但是在设备或仿真器中均未收到该通知,并且LogCat中没有错误。

我正在使用运行Android OS 4.3的设备和运行Android OS 4.0.3的 AVD
我正在使用“推送通知入门”培训模块示例进行尝试。

application-descriptor.xml中 ,我设置了:

<pushSender key="AIzaSyDXNiXutgh9XhX8eB8AFa2-00jbyVWM2zI" senderId="470484369549"/> 

senderID是项目编号: 在此处输入图片说明

并且密钥是从Google API控制台获取的 :通过“ 创建新的服务器密钥”选项

在此处输入图片说明 当我在设备上运行App并执行推送适配器以发送推送消息时,Eclipse Studio控制台会给出以下异常:

[2013-12-27 06:18:12]             Invoking procedure: 'submitNotification' of adapter 'PushAdapter'
[2013-12-27 06:18:12]             Server host: localhost
[2013-12-27 06:18:12]             Server port: 8080
[2013-12-27 06:18:12]             Parameters: ["aahad","this is example"]
[2013-12-27 06:18:12]             Procedure invocation finished
[2013-12-27 06:18:13] FWLSE0094E: Error while attempting to invoke GCM service (for sender key starting with 'AIzaSyDX'), sending will not resume until server is restarted or application re-deployed
[2013-12-27 06:18:13] FWLSE0093E: Failed to invoke Google GCM push service.
                                  com.worklight.integration.notification.gcm.GCMSender.sendNoRetry(GCMSender.java:225)
                                  com.worklight.integration.notification.gcm.GCMSender.sendAndVerify(GCMSender.java:127)
                                  com.worklight.integration.notification.gcm.GCMMediator.sendOrWait(GCMMediator.java:135)
                                  com.worklight.integration.notification.gcm.GCMMediator.sendNotification(GCMMediator.java:124)
                                  com.worklight.integration.notification.Mediator$4.run(Mediator.java:174)
                                  java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
                                  java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
                                  java.util.concurrent.FutureTask.run(Unknown Source)
                                  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                                  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                                  java.lang.Thread.run(Unknown Source)
[2013-12-27 06:18:13] FWLSE0094E: Error while attempting to invoke GCM service (for sender key starting with 'AIzaSyDX'), sending will not resume until server is restarted or application re-deployed
[2013-12-27 06:18:13] FWLSE0094E: Error while attempting to invoke GCM service (for sender key starting with 'AIzaSyDX'), sending will not resume until server is restarted or application re-deployed
[2013-12-27 06:18:13] FWLSE0094E: Error while attempting to invoke GCM service (for sender key starting with 'AIzaSyDX'), sending will not resume until server is restarted or application re-deployed
[2013-12-27 06:18:13] FWLSE0094E: Error while attempting to invoke GCM service (for sender key starting with 'AIzaSyDX'), sending will not resume until server is restarted or application re-deployed
[2013-12-27 06:18:13] FWLSE0093E: Failed to invoke Google GCM push service.
                                  com.worklight.integration.notification.gcm.GCMSender.sendNoRetry(GCMSender.java:225)
                                  com.worklight.integration.notification.gcm.GCMSender.sendAndVerify(GCMSender.java:127)
                                  com.worklight.integration.notification.gcm.GCMMediator.sendOrWait(GCMMediator.java:135)
                                  com.worklight.integration.notification.gcm.GCMMediator.sendNotification(GCMMediator.java:124)
                                  com.worklight.integration.notification.Mediator$4.run(Mediator.java:174)
                                  java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
                                  java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
                                  java.util.concurrent.FutureTask.run(Unknown Source)
                                  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                                  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                                  java.lang.Thread.run(Unknown Source)

LogCat显示:

12-27 17:26:47.750: D/Cordova(5639): onPageFinished(file:///data/data/com.PushApplication/files/www/default/PushApplication.html)
12-27 17:26:47.750: D/DroidGap(5639): onMessage(onNativeReady,null)
12-27 17:26:47.750: D/DroidGap(5639): onMessage(onPageFinished,file:///data/data/com.PushApplication/files/www/default/PushApplication.html)
12-27 17:26:47.850: D/CordovaNetworkManager(5639): Connection Type: wifi
12-27 17:26:47.850: D/CordovaNetworkManager(5639): Connection Type: wifi
12-27 17:26:47.850: D/DroidGap(5639): onMessage(networkconnection,wifi)
12-27 17:26:47.860: D/DroidGap(5639): onMessage(spinner,stop)
12-27 17:26:47.860: D/PushApplication(5639): ondeviceready event dispatched
12-27 17:26:47.870: D/PushApplication(5639): wlclient init started
12-27 17:26:47.870: D/PushApplication(5639): Read cookies: null
12-27 17:26:47.880: D/PushApplication(5639): CookieMgr read cookies: {}
12-27 17:26:48.870: D/DroidGap(5639): onMessage(spinner,stop)
12-27 17:26:49.220: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/init]
12-27 17:26:49.490: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/init]
12-27 17:26:49.640: D/PushApplication(5639): Clearing notification subscriptions.
12-27 17:26:49.640: D/PushApplication(5639): Send new server notification token id.
12-27 17:26:49.640: W/WLDroidGap(5639): unregisterReceivers:Receiver not registered: com.worklight.androidgap.plugin.Push$1@420ee688
12-27 17:26:49.640: W/WLDroidGap(5639): unregisterReceivers:Receiver not registered: com.worklight.androidgap.plugin.Push$3@420eebb8
12-27 17:26:49.680: D/dalvikvm(5639): GC_FOR_ALLOC freed 334K, 5% free 7765K/8164K, paused 15ms, total 16ms
12-27 17:26:49.680: D/WLDroidGap(5639): Registering at the GCM server.
12-27 17:26:49.680: V/GCMRegistrar(5639): Registering receiver
12-27 17:26:49.680: D/GCMRegistrar(5639): resetting backoff for com.PushApplication
12-27 17:26:49.690: D/PushApplication(5639): response [http://192.168.48.69:8080/apps/services/api/PushApplication/android/init] success: /*-secure-
12-27 17:26:49.690: D/PushApplication(5639): {"userPrefs":{},"WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"ce6ll85omecut37aatqrfojfj5","attributes":{},"isUserAuthenticated":1,"displayName":"ce6ll85omecut37aatqrfojfj5"},"wl_deviceNoProvisioningRealm":{"userId":"b65b4d32-93aa-4d2d-89ab-bff0a8c7c9af","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData@2c70f885"},"isUserAuthenticated":1,"displayName":"b65b4d32-93aa-4d2d-89ab-bff0a8c7c9af"},"wl_anonymousUserRealm":{"userId":"5125bfe6-d34c-4dce-b5cd-e6c76d902536","attributes":{},"isUserAuthenticated":1,"displayName":"5125bfe6-d34c-4dce-b5cd-e6c76d902536"}},"notificationSubscriptionState":{},"gadgetProps":{"directUpdate":{"updateUnpackedSize":1019860,"availableSkins":["default"],"checksum":695958230,"updateSize":290361},"ENVIRONMENT":"android"},"userInfo":{"wl_authenticityRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"PushAppRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_antiXSRFRealm":{"userId":"ce6ll85omecut37aatqrfojfj5","attributes":{},"isUserAuthenticated":1,"displayName":"ce6ll85omecut37aatqrfojfj5"},"wl_deviceAutoProvisioningRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceNoProvisioningRealm":{"userId":"b65b4d32-93aa-4d2d-89ab-bff0a8c7c9af","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData@2c70f885"},"isUserAuthenticated":1,"displayName":"b65b4d32-93aa-4d2d-89ab-bff0a8c7c9af"},"myserver":{"userId":"5125bfe6-d34c-4dce-b5cd-e6c76d902536","attributes":{},"isUserAuthenticated":1,"displayName":"5125bfe6-d34c-4dce-b5cd-e6c76d902536"},"wl_anonymousUserRealm":{"userId":"5125bfe6-d34c-4dce-b5cd-e6c76d902536","attributes":{},"isUserAuthenticated":1,"displayName":"5125bfe6-d34c-4dce-b5cd-e6c76d902536"}}}*/
12-27 17:26:49.690: D/PushApplication(5639): wlclient connect success
12-27 17:26:49.690: D/PushApplication(5639): before: app init onSuccess
12-27 17:26:49.700: D/PushApplication(5639): after: app init onSuccess
12-27 17:26:49.700: D/PushApplication(5639): wlclient init success
12-27 17:26:49.700: V/GCMRegistrar(5639): Registering app com.PushApplication of senders 470484369549
12-27 17:26:50.190: V/GCMBroadcastReceiver(5639): onReceive: com.google.android.c2dm.intent.REGISTRATION
12-27 17:26:50.190: V/GCMBroadcastReceiver(5639): GCM IntentService class: com.PushApplication.GCMIntentService
12-27 17:26:50.200: V/GCMBaseIntentService(5639): Acquiring wakelock
12-27 17:26:50.200: V/GCMBaseIntentService(5639): Intent service name: GCMIntentService-470484369549-1
12-27 17:26:50.210: D/GCMBaseIntentService(5639): handleRegistration: registrationId = APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q, error = null, unregistered = null
12-27 17:26:50.210: D/GCMRegistrar(5639): resetting backoff for com.PushApplication
12-27 17:26:50.210: V/GCMRegistrar(5639): Saving regId on app version 1
12-27 17:26:50.210: D/WLDroidGap(5639): Registered at the GCM server with registration id APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:26:50.220: D/WLDroidGap(5639): Successfully registered to GCM notification service with token id APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:26:50.220: V/GCMBaseIntentService(5639): Releasing wakelock
12-27 17:26:50.220: D/PushApplication(5639): Push notification device token has changed, updating server notification token id.
12-27 17:26:50.230: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:26:50.440: D/PushApplication(5639): response [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications] success: /*-secure-
12-27 17:26:50.440: D/PushApplication(5639): {"errors":[],"isSuccessful":true,"warnings":[],"info":[]}*/
12-27 17:27:04.920: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:27:06.900: D/SoftKeyboardDetect(5639): Ignore this event
12-27 17:27:07.000: D/SoftKeyboardDetect(5639): Ignore this event
12-27 17:27:12.060: D/SoftKeyboardDetect(5639): Ignore this event
12-27 17:27:12.070: W/IInputConnectionWrapper(5639): getTextBeforeCursor on inactive InputConnection
12-27 17:27:12.080: W/IInputConnectionWrapper(5639): getTextBeforeCursor on inactive InputConnection
12-27 17:27:12.170: D/SoftKeyboardDetect(5639): Ignore this event
12-27 17:27:16.120: D/SoftKeyboardDetect(5639): Ignore this event
12-27 17:27:17.910: D/PushApplication(5639): Request [login]
12-27 17:27:20.750: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:27:20.780: D/PushApplication(5639): Clearing notification subscriptions.
12-27 17:27:20.780: D/PushApplication(5639): Updating notification subscriptions.
12-27 17:27:20.790: D/WLDroidGap(5639): Registering at the GCM server.
12-27 17:27:20.790: D/PushApplication(5639): response [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications] success: /*-secure-
12-27 17:27:20.790: D/PushApplication(5639): {"isSuccessful":true,"WL-Authentication-Success":{"PushAppRealm":{"userId":"aahad","attributes":{},"isUserAuthenticated":1,"displayName":"aahad"}},"notificationSubscriptionState":{"eventSources":[{"eventSource":"PushEventSource","alias":"myPush","adapter":"PushAdapter"}],"token":"APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q"}}*/
12-27 17:27:20.790: D/GCMRegistrar(5639): resetting backoff for com.PushApplication
12-27 17:27:20.790: V/GCMRegistrar(5639): Registering app com.PushApplication of senders 470484369549
12-27 17:27:21.500: V/GCMBroadcastReceiver(5639): onReceive: com.google.android.c2dm.intent.REGISTRATION
12-27 17:27:21.500: V/GCMBroadcastReceiver(5639): GCM IntentService class: com.PushApplication.GCMIntentService
12-27 17:27:21.500: V/GCMBaseIntentService(5639): Acquiring wakelock
12-27 17:27:21.510: V/GCMBaseIntentService(5639): Intent service name: GCMIntentService-470484369549-2
12-27 17:27:21.510: D/GCMBaseIntentService(5639): handleRegistration: registrationId = APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q, error = null, unregistered = null
12-27 17:27:21.510: D/GCMRegistrar(5639): resetting backoff for com.PushApplication
12-27 17:27:21.520: V/GCMRegistrar(5639): Saving regId on app version 1
12-27 17:27:21.520: D/WLDroidGap(5639): Registered at the GCM server with registration id APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:27:21.520: D/WLDroidGap(5639): Successfully registered to GCM notification service with token id APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:27:21.520: V/GCMBaseIntentService(5639): Releasing wakelock
12-27 17:27:24.030: E/PushApplication(5639): Cannot register to event source callback with existing alias: myPush
12-27 17:28:15.890: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:28:16.140: D/PushApplication(5639): response [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications] success: /*-secure-
12-27 17:28:16.140: D/PushApplication(5639): {"isSuccessful":true}*/
12-27 17:28:16.170: D/dalvikvm(5639): GC_FOR_ALLOC freed 321K, 5% free 7957K/8340K, paused 15ms, total 16ms
12-27 17:28:23.520: D/PushApplication(5639): Request [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:28:23.630: D/PushApplication(5639): response [http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications] success: /*-secure-
12-27 17:28:23.630: D/PushApplication(5639): {"isSuccessful":true}*/

我已经在运行Android 4.3的AVD上成功使用了“推送通知”示例应用程序。

工作灯设置:

  1. 进口样品
  2. 使用Google GCM控制台中的API KeyProject Number替换了application-descriptor.xmlAPI KeysenderId
    • 注意:对于API密钥,请确保您生成浏览器密钥Google文档
  3. 在以下行的yourApp\\android\\native\\AndroidManifest.xml中添加了android:targetSdkVersion="18"

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" />

  4. 构建和部署应用程序和适配器

  5. 右键单击生成的Android项目>属性> Android,然后将构建目标更改为Android 4.3

AVD设置:

  1. 确保您已在“ Android SDK管理器”中的Extras部分中安装了Google Cloud Messaging for Android LibraryGoogle Play services
  2. 确保为您在AVD中使用的API级别安装适当的Google API
  3. 确保为您在AVD中使用的API级别安装Android映像
  4. 确保将此Google API用作您的AVD的Target

    在此处输入图片说明

之后,我有:

  1. 在AVD中启动了该应用
  2. 用“ idan”登录
  3. 点击“订阅”按钮
  4. 确保我确实已订阅(“ isSubscribed”按钮”)并能​​够接收通知(“ isPushSupported”按钮)
  5. 右键单击“ PushAdapter”文件夹,然后选择Run As > Invoke Worklight Procedure
  6. 使用参数: "idan","test message"

既在打开应用程序(显示预期警报)又在关闭应用程序(在通知栏中显示通知。在应用程序中点按它即可打开应用程序,并在登录预期警报后)在AVD中收到通知。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM