Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Worklight在Android上启用推送通知_Android_Push Notification_Ibm Mobilefirst - Fatal编程技术网

使用Worklight在Android上启用推送通知

使用Worklight在Android上启用推送通知,android,push-notification,ibm-mobilefirst,Android,Push Notification,Ibm Mobilefirst,我在Android上使用推送通知时遇到了一些问题。我在application-descriptor.xml的android部分添加了一个pushSender,其中包含生成的密钥(我删除了我们的键值) 我们的钥匙 每次启动应用程序时,我都会收到消息“注册推送通知失败。应用程序将无法接收通知。” 我想了一会儿,这可能是因为我在我们的内部网络上进行测试,它需要访问外部世界,但即使它可以访问外部世界,我仍然收到了消息。我尝试将securityTest参数添加到android标记中,但没有任何区别 在

我在Android上使用推送通知时遇到了一些问题。我在application-descriptor.xml的android部分添加了一个pushSender,其中包含生成的密钥(我删除了我们的键值)


我们的钥匙
每次启动应用程序时,我都会收到消息“注册推送通知失败。应用程序将无法接收通知。”

我想了一会儿,这可能是因为我在我们的内部网络上进行测试,它需要访问外部世界,但即使它可以访问外部世界,我仍然收到了消息。我尝试将securityTest参数添加到android标记中,但没有任何区别

在authenticationconfig.xml文件中,我向安全测试部分添加了一个移动安全测试:

    <mobileSecurityTest name="PushApp-securityTest">
        <testDeviceId provisioningType="none"/>
        <testUser realm="PushAppRealm"/>
    </mobileSecurityTest>

我的领域设置如下:

    <realm name="PushAppRealm" loginModule="PushAppLoginModule">
        <className>com.worklight.core.auth.ext.PersistentCookieAuthenticator</className>
    </realm>    
    <loginModule name="PushAppLoginModule">
        <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
    </loginModule>  

com.worklight.core.auth.ext.PersistentCookieAuthenticator
登录模块如下所示:

    <realm name="PushAppRealm" loginModule="PushAppLoginModule">
        <className>com.worklight.core.auth.ext.PersistentCookieAuthenticator</className>
    </realm>    
    <loginModule name="PushAppLoginModule">
        <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
    </loginModule>  

com.worklight.core.auth.ext.NonValidatingLoginModule
我真的不明白为什么它无法注册。我们正在运行Worklight 5.0.6.2。

来自评论:

要使其工作,您是否必须使用某种实际登录(即。 输入用户id/密码)

如果您使用的是基于事件源的通知,则是-需要登录。
您可以在此处阅读解释:


这听起来像是为了满足您的这种特殊需要,您可以使用广播或基于标记的通知。您可以在中阅读有关这些类型的更多信息。本主题还提供了要跟进的示例实现。

请参阅下面问题中给出的我的设置。虽然使用6.2对其进行了测试,但在5.0.6.2中也是一样的:@idan adar工作时,您是否必须使用某种实际登录(即输入用户id/密码)?我们希望允许应用程序在不登录的情况下接收推送通知,我认为PersistenCookieAuthenticator会允许。我已经完成了设置GCM密钥的过程。我没有意识到我们需要使用浏览器密钥而不是服务器密钥,但即使使用浏览器密钥,我仍然无法注册message.你可以明确注册该设备,但必须是一个好公民(应用程序)我们不打算盲目地为推送通知设置用户。我们要检查他们是否已注册,并给他们一个弹出窗口,询问他们是否愿意接收通知。我输入的密钥可能有问题吗?我的印象是PersistentCookieAuthenticator将创建一个设备类型ID作为“用户”注册,这样就不需要显式登录。我只是想知道这个键,就好像我从应用描述符中注释掉了pushSender,但没有删除任何推送通知的代码一样,应用启动得很好。senderID的值是否正确?我收到了相同的错误消息,只是发现我使用的是“项目ID”而不是“项目编号”。您需要在senderID字段中使用“项目编号”。