问题描述
我跟所有的步骤在推送通知培训模块,以及在这个堆栈溢出问题:<一href="http://stackoverflow.com/questions/17021158/ibm-worklight-push-notifications-feature-does-not-work-in-android-emulator?rq=1">IBM工作灯 - 推送通知功能在Android模拟器不起作用
当我通过发送PushBackendEmulator消息或从URL调用PushAdapter程序,它说成功发送邮件
,但通知没有在任何设备或仿真器和接收有在LogCat中没有错误。
我使用的设备上运行的的Android OS 4.3 和AVD运行的Android OS 4.0.3。
我想这与推送通知入门培训模块的样本。
在应用descriptor.xml ,我已经设置:
&LT; pushSender键=AIzaSyDXNiXutgh9XhX8eB8AFa2-00jbyVWM2zIsenderId =470484369549/&GT;
senderID 是项目编号:
和键摘自谷歌API控制台:按创建新的服务器密钥选项
当我在设备上运行的应用程序,并执行推适配器发送推送消息,然后在Eclipse Studio控制台提供了以下异常:
[2013年12月27号六时18分12秒]调用程序:适配器submitNotification'PushAdapter
[2013年12月27号6点18分12秒]服务器主机:本地主机
[2013年12月27号6点18分12秒]服务器端口:8080
[2013年12月27号6点18分12秒]参数:[aahad,这是例子]
[2013年12月27号6点18分12秒]过程调用完成
[2013年12月27号6点18分13秒] FWLSE0094E:错误试图调用GCM服务(发送方键以'AIzaSyDX),发送将不会恢复,直到重新启动服务器或应用程序重新部署
[2013年12月27号6点18分13秒] FWLSE0093E:未能调用谷歌GCM推送服务。
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(来源不明)
java.util.concurrent.FutureTask中$ Sync.innerRun(来源不明)
java.util.concurrent.FutureTask.run(来源不明)
java.util.concurrent.ThreadPoolExecutor.runWorker(来源不明)
java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(来源不明)
java.lang.Thread.run(来源不明)
[2013年12月27号6点18分13秒] FWLSE0094E:错误试图调用GCM服务(发送方键以'AIzaSyDX),发送将不会恢复,直到重新启动服务器或应用程序重新部署
[2013年12月27号6点18分13秒] FWLSE0094E:错误试图调用GCM服务(发送方键以'AIzaSyDX),发送将不会恢复,直到重新启动服务器或应用程序重新部署
[2013年12月27号6点18分13秒] FWLSE0094E:错误试图调用GCM服务(发送方键以'AIzaSyDX),发送将不会恢复,直到重新启动服务器或应用程序重新部署
[2013年12月27号6点18分13秒] FWLSE0094E:错误试图调用GCM服务(发送方键以'AIzaSyDX),发送将不会恢复,直到重新启动服务器或应用程序重新部署
[2013年12月27号6点18分13秒] FWLSE0093E:未能调用谷歌GCM推送服务。
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(来源不明)
java.util.concurrent.FutureTask中$ Sync.innerRun(来源不明)
java.util.concurrent.FutureTask.run(来源不明)
java.util.concurrent.ThreadPoolExecutor.runWorker(来源不明)
java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(来源不明)
java.lang.Thread.run(来源不明)
和 LogCat中显示:
12-27 17:26:47.750:D /科尔多瓦(5639):onPageFinished(文件:///data/data/com.PushApplication/files/www/default/PushApplication的.html)
12-27 17:26:47.750:D / DroidGap(5639)的onMessage(onNativeReady,空)
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):连接类型:无线
12-27 17:26:47.850:D / CordovaNetworkManager(5639):连接类型:无线
12-27 17:26:47.850:D / DroidGap(5639)的onMessage(networkconnection,WIFI)
12-27 17:26:47.860:D / DroidGap(5639)的onMessage(微调,停止)
12-27 17:26:47.860:D / PushApplication(5639):ondeviceready事件调度
12-27 17:26:47.870:D / PushApplication(5639):wlclient init启动
12-27 17:26:47.870:D / PushApplication(5639):阅读饼干:空
12-27 17:26:47.880:D / PushApplication(5639):CookieMgr读取cookies:{}
12-27 17:26:48.870:D / DroidGap(5639)的onMessage(微调,停止)
12-27 17:26:49.220:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/init]
12-27 17:26:49.490:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/init]
12-27 17:26:49.640:D / PushApplication(5639):清除通知订阅。
12-27 17:26:49.640:D / PushApplication(5639):发送新的服务器通知标记ID。
12-27 17:26:49.640:W / WLDroidGap(5639):unregisterReceivers:接收未注册:com.worklight.androidgap.plugin.Push$1@420ee688
12-27 17:26:49.640:W / WLDroidGap(5639):unregisterReceivers:接收未注册:com.worklight.androidgap.plugin.Push$3@420eebb8
12-27 17:26:49.680:D / dalvikvm(5639):GC_FOR_ALLOC释放334K,5%的游离7765K / 8164K,暂停15毫秒,16毫秒总
12-27 17:26:49.680:D / WLDroidGap(5639):注册在GCM服务器。
12-27 17:26:49.680:V / GCMRegistrar(5639):注册接收器
12-27 17:26:49.680:D / GCMRegistrar(5639):重置退避的com.PushApplication
12-27 17:26:49.690:D / PushApplication(5639):响应[http://192.168.48.69:8080/apps/services/api/PushApplication/android/init]成功:/ * - 安全 -
12-27 17:26:49.690:D / PushApplication(5639): {"user$p$pfs":{},"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"},"PushAp$p$palm":{"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连接成功
12-27 17:26:49.690:D / PushApplication(5639):前:应用程序初始化的onSuccess
12-27 17:26:49.700:D / PushApplication(5639):经过:应用程序初始化的onSuccess
12-27 17:26:49.700:D / PushApplication(5639):wlclient初始化成功
12-27 17:26:49.700:V / GCMRegistrar(5639):注册发件人470484369549的应用程序com.PushApplication
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类:com.PushApplication.GCMIntentService
12-27 17:26:50.200:V / GCMBaseIntentService(5639):收购wakelock
12-27 17:26:50.200:V / GCMBaseIntentService(5639):意图服务名称:GCMIntentService-470484369549-1
12-27 17:26:50.210:D / GCMBaseIntentService(5639):handleRegistration:registrationId = APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q,错误= NULL,未注册= NULL
12-27 17:26:50.210:D / GCMRegistrar(5639):重置退避的com.PushApplication
12-27 17:26:50.210:V / GCMRegistrar(5639):保存REGID上的应用程序版本1
12-27 17:26:50.210:D / WLDroidGap(5639):在GCM服务器注册ID注册APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:26:50.220:D / WLDroidGap(5639):成功注册GCM通知服务与标记ID APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:26:50.220:V / GCMBaseIntentService(5639):释放wakelock
12-27 17:26:50.220:D / PushApplication(5639):推送通知设备令牌已经改变,更新服务器通知标记ID。
12-27 17:26:50.230:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:26:50.440:D / PushApplication(5639):响应[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]成功:/ * - 安全 -
12-27 17:26:50.440:D / PushApplication(5639):{错误:[],isSuccessful:真实,警告:[],信息:[]} * /
12-27 17:27:04.920:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:27:06.900:D / SoftKeyboardDetect(5639):忽略此事件
12-27 17:27:07.000:D / SoftKeyboardDetect(5639):忽略此事件
12-27 17:27:12.060:D / SoftKeyboardDetect(5639):忽略此事件
12-27 17:27:12.070:W / IInputConnectionWrapper(5639):getTextBeforeCursor上的非活动InputConnection
12-27 17:27:12.080:W / IInputConnectionWrapper(5639):getTextBeforeCursor上的非活动InputConnection
12-27 17:27:12.170:D / SoftKeyboardDetect(5639):忽略此事件
12-27 17:27:16.120:D / SoftKeyboardDetect(5639):忽略此事件
12-27 17:27:17.910:D / PushApplication(5639):请求[登录]
12-27 17:27:20.750:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:27:20.780:D / PushApplication(5639):清除通知订阅。
12-27 17:27:20.780:D / PushApplication(5639):更新通知订阅。
12-27 17:27:20.790:D / WLDroidGap(5639):注册在GCM服务器。
12-27 17:27:20.790:D / PushApplication(5639):响应[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]成功:/ * - 安全 -
12-27 17:27:20.790:D / PushApplication(5639): {"isSuccessful":true,"WL-Authentication-Success":{"PushAp$p$palm":{"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):重置退避的com.PushApplication
12-27 17:27:20.790:V / GCMRegistrar(5639):注册发件人470484369549的应用程序com.PushApplication
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类:com.PushApplication.GCMIntentService
12-27 17:27:21.500:V / GCMBaseIntentService(5639):收购wakelock
12-27 17:27:21.510:V / GCMBaseIntentService(5639):意图服务名称:GCMIntentService-470484369549-2
12-27 17:27:21.510:D / GCMBaseIntentService(5639):handleRegistration:registrationId = APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q,错误= NULL,未注册= NULL
12-27 17:27:21.510:D / GCMRegistrar(5639):重置退避的com.PushApplication
12-27 17:27:21.520:V / GCMRegistrar(5639):保存REGID上的应用程序版本1
12-27 17:27:21.520:D / WLDroidGap(5639):在GCM服务器注册ID注册APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:27:21.520:D / WLDroidGap(5639):成功注册GCM通知服务与标记ID APA91bEGLOHqoQHlmmb-wLCEzKFxrW2UHKaeMWnheA8nebNXNojI6O7o3B4BOnAc_tFXe8H3rsg6g4JH3mQl2vh5p8DxXbNhHgiSts-q2HFYFAT1l07Il-2QiRS0ypHLD4kGFQss0ueZWymkzOxypsFBQKPvezKq3Q
12-27 17:27:21.520:V / GCMBaseIntentService(5639):释放wakelock
12-27 17:27:24.030:E / PushApplication(5639):不能注册到事件源的回调与现有的别名:myPush
12-27 17:28:15.890:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:28:16.140:D / PushApplication(5639):响应[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]成功:/ * - 安全 -
12-27 17:28:16.140:D / PushApplication(5639):{isSuccessful:真} * /
12-27 17:28:16.170:D / dalvikvm(5639):GC_FOR_ALLOC释放321K,5%的游离7957K / 8340K,暂停15毫秒,16毫秒总
12-27 17:28:23.520:D / PushApplication(5639):请求[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]
12-27 17:28:23.630:D / PushApplication(5639):响应[http://192.168.48.69:8080/apps/services/api/PushApplication/android/notifications]成功:/ * - 安全 -
12-27 17:28:23.630:D / PushApplication(5639):{isSuccessful:真} * /
我已经成功地使用在一个AVD运行推送通知示例应用程序的Android 4.3。
工作灯设置:
- 进口样品
- 在替换
应用descriptor.xml的
与API密钥
和senderId
API密钥
和项目数
从谷歌GCM控制台- 注:API密钥确保你生成一个浏览器键()
-
新增
安卓targetSdkVersion =18
在yourApp \机器人\本地\ AndroidManifest.xml中
在该行: -
构建和部署应用程序和适配器
- 右键单击生成的Android项目>属性>的Android,改变了构建目标为
安卓4.3
AVD设置:
- 确保了在Android SDK管理器,你已经从
其他
部分均谷歌云消息传递为Android库$ C $安装C>以及
谷歌播放服务
- 确保安装相应的谷歌API,用于在您的AVD您所使用的API级别
- 确保安装Android形象在你的AVD您所使用的API级别
-
请务必使用谷歌API的
目标
为您的AVD:
在我有:
- 推出的AVD 应用程序
- 在登录时使用IDAN
- 螺纹的订阅按钮
- 在确信我倒真订阅(isSubscribed按钮),并能够接收通知(isPushSupported按钮)
- 右键点击该文件夹PushAdapter并选择
运行方式&GT;调用工作灯程序
- 使用的参数:
IDAN,测试消息
收到两个,当应用程序是开放的(被显示预期警报)的AVD通知以及封闭(通知被显示在通知栏。攻其打开应用程序,并记录在预期警报之后显示)。
I followed all steps as given in the Push Notifications training module, as well as in this Stack Overflow question: IBM Worklight - Push Notifications feature does not work in Android emulator
When I send a message using the PushBackendEmulator or by calling the PushAdapter procedure from URL it says message sent successfully
, but the notification is not received in either device or emulator and there is no error in LogCat.
I am using a device running Android OS 4.3 and AVD running Android OS 4.0.3.
I am trying this with the Push Notification Getting Started training module sample.
In application-descriptor.xml, I have set:
<pushSender key="AIzaSyDXNiXutgh9XhX8eB8AFa2-00jbyVWM2zI" senderId="470484369549"/>
senderID is the project number:
and the key is taken from Google APIs Console : by Create new Server Key option
When I run the App on device and execute push adapter to send push message then the Eclipse Studio console gives below exceptions:
[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)
and LogCat shows:
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}*/
I have successfully used the Push Notifications sample application on an AVD running Android 4.3.
Worklight setup:
- Imported the sample
- Replaced the
API Key
andsenderId
inapplication-descriptor.xml
with theAPI Key
andProject Number
from the Google GCM console- Note: for API Key make sure you generate a browser key (Google documentation)
Added
android:targetSdkVersion="18"
inyourApp\android\native\AndroidManifest.xml
in the line:Built and deployed the app and adapter
- Right-clicked the generated Android project > Properties > Android and changed the Build Target to
Android 4.3
AVD setup:
- Make sure that in the Android SDK Manager you have installed from the
Extras
section both theGoogle Cloud Messaging for Android Library
as well asGoogle Play services
- Make sure to install the appropriate Google APIs for the API Level you are using in your AVD
- Make sure to install the Android image for the API Level you are using in your AVD
Make sure to use this Google API as the
Target
for your AVD:
After that I have:
- Launched the app in the AVD
- Logged in with "idan"
- Tapped the "Subscribe" button
- Made sure I am indeed subscribed ("isSubscribed" button") and able to receive notifications ("isPushSupported" button)
- Right-clicked on the PushAdapter folder and chose
Run As > Invoke Worklight Procedure
- Used the parameters:
"idan","test message"
The notification was received in the AVD both when the app is open (the expected alerts were displayed) as well as closed (notification was displayed in the notification bar. Tapping it opened the app and after logging in the expected alerts were displayed).
这篇关于IBM工作灯5.0.6.1 - Android的通知没有达到任何设备或模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!