Worklight 6.3通过GCM的推送通知未到达android设备

Worklight 6.3通过GCM的推送通知未到达android设备,android,push-notification,google-cloud-messaging,ibm-mobilefirst,Android,Push Notification,Google Cloud Messaging,Ibm Mobilefirst,我正在IBM Worklight 6.3上开发一个应用程序,该应用程序使用推送通知。该应用程序使用IBM Websphere application server 8.5.5.0。下面是我们必须使推送通知工作的详细信息 对于android代码,我添加了google服务器密钥作为API密钥,项目编号作为发送者id。我也尝试使用google浏览器密钥,因为之前的帖子很少建议使用IBM声明要使用的服务器密钥 对于android清单 <uses-permission android:name="a

我正在IBM Worklight 6.3上开发一个应用程序,该应用程序使用推送通知。该应用程序使用IBM Websphere application server 8.5.5.0。下面是我们必须使推送通知工作的详细信息

  • 对于android代码,我添加了google服务器密钥作为API密钥,项目编号作为发送者id。我也尝试使用google浏览器密钥,因为之前的帖子很少建议使用IBM声明要使用的服务器密钥
  • 对于android清单

    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>  
    <uses-permission android:name="android.permission.WAKE_LOCK"/>  
    <permission android:name="com.POCMobileApp.permission.C2D_MESSAGE" android:protectionLevel="signature"/>  
    <uses-permission android:name="com.POCMobileApp.permission.C2D_MESSAGE"/>  
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>  
    
    <service android:name="com.POCMobileApp.GCMIntentService"/>  
    <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> 
        <!-- Receive the actual message -->  
        <intent-filter> 
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>  
            <category android:name="com.POCMobileApp"/> 
        </intent-filter>  
        <!-- Receive the registration id -->  
        <intent-filter> 
            <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>  
            <category android:name="com.POCMobileApp"/> 
        </intent-filter> 
    </receiver> 
    
  • 定义了可以提交通知的适配器过程

    function sendBroadcastNotification(notificationText) {
    
    WL.Logger.info("Notification text -> " + notificationText);
    
    var notificationOptions = {};
    notificationOptions.message = {};
    notificationOptions.message.alert = notificationText;
    
    notificationOptions.settings = {};
    notificationOptions.settings.gcm = {};
    notificationOptions.settings.gcm.payload = {"custom":"data"};
    
    try {
        var timeOut = WL.Server.sendMessage("POCMobileApp", notificationOptions);
    }
    catch(e) {
        WL.Logger.info("Error encountered -> " + e);
    }
    
    return {
        result : "Notification sent to all users."
    };
    }
    
  • 函数WL.Client.Push.onMessage的客户端实现

  • 我正在调用适配器过程,如下所示

    https://myServername:9443/myApplication/invoke?adapter=PushNotificationAdapter&procedure=sendBroadcastNotification&parameters=%5B"test+notification"%5D
    
    这就回到下面

    /*-secure-
    {"result":"Notification sent to all users.","isSuccessful":true}*/
    
    调用过程时没有错误,但在订阅的设备上没有收到通知。从设备的logcat跟踪中,我了解到设备已与GCM服务器建立连接,并且注册成功。以下是这些痕迹:

    12-1021:40:09.151:V/GCMBroadcastReceiver(18771):接收: com.google.android.c2dm.intent.REGISTRATION 12-10 21:40:09.151: V/GCMBroadcastReceiver(18771):GCM意向服务等级: com.POCMobileApp.gcminentservice 12-1021:40:09.151: V/GCMBaseIntentService(18771):获取尾波锁12-1021:40:09.156: V/GCMBaseIntentService(18771):意向服务名称: gcminentservice-DynamicSenderIds-212-1021:40:09.161: D/GCMBaseIntentService(18771):手部注册:注册ID= APA91bH-QI73VPF5SQVUVDKQHA9QFNZVKA5FZGHGH——Tays9I9WCEZMWUFTZ837EJXTFF3I8NMFR7JDBIYLGURGXREOUUAYJ62VMFZZOROFLBOC6F9RKNKVXSOR3GAFWSRZNIJNWP, 错误=null,未注册=null 12-10 21:40:09.161: D/GCMRegistar(18771):重置com.POCMobileApp 12-10的回退 21:40:09.161:V/gcmregistar(18771):在应用程序版本1上保存注册表 12-1021:40:09.166:D/GCMinentService(18771): gcminentservice.on在gcminentservice.java中注册:81:: WLGCMinentService:在GCM服务器上注册,注册id为 APA91bH-QI_73VPF5SQVUVDKQHA9QFZVKA5FZGHGH--

    你能告诉我哪里出了问题吗?还有,我不清楚调用WL.Server.sendMessage(在适配器级别)如何与GCM服务器建立连接,有人能澄清一下吗

    编辑

    我注意到,每次调用适配器时,SystemErr.log中都会出现以下错误

    [12/14/15 12:33:44:452 EST]00000074系统错误 java.util.MissingResourceException:找不到捆绑包的资源 java.util.PropertyResourceBundle,键无法搭载 由于从客户端发送的头无效或不完整,configprofile [12/14/15 12:33:44:452 EST]00000074系统错误在 getObject(ResourceBundle.java:404)[12/14/15 12:33:44:452 EST]00000074系统错误在 getString(ResourceBundle.java:364)[12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.common.i18n.MessageFormatter.format(MessageFormatter.java:111) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.common.i18n.MessageFormatter.format(MessageFormatter.java:89) [12/14/15 12:33:44:452 EST]00000074系统错误在 worklight.common.log.WorklightServerLogger.warn(WorklightServerLogger.java:64) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.gadgets.service.ClientConfigProfileServlet.piggybackConfigProfile(ClientConfigProfileServlet.java:238) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.gadgets.service.InvokeProcServlet.service(InvokeProcServlet.java:82) [12/14/15 12:33:44:452 EST]00000074系统错误在 javax.servlet.http.HttpServlet.service(HttpServlet.java:668)[12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1227) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.servlet.ServletWrapper.HandlerRequest(ServletWrapper.java:776) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.servlet.ServletWrapper.HandlerRequest(ServletWrapper.java:458) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.HandlerRequest(ServletWrapperImpl.java:178) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:217) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:222) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025) [12/14/15 12:33:44:452 EST]00000074系统错误在 com.ibm.ws.webcontainer.webapp.webapp.handleRequest(webapp.java:3761) [12/14/15 12:33:44:452 EST]00000074 Sy
    /*-secure-
    {"result":"Notification sent to all users.","isSuccessful":true}*/