简体   繁体   English

在没有gcm的情况下解析推送通知

[英]Parse push notifications without gcm

I was implementing Parse push notifications in my project but, due to legal issues, I'm not able to install Google play services, so the broadcast receiver used to receive notifications is the ParsePushBroadcastReceiver, not the GcmBroadcastReceiver. 我当时在我的项目中实施了Parse推送通知,但是由于法律问题,我无法安装Google Play服务,因此用于接收通知的广播接收器是ParsePushBroadcastReceiver,而不是GcmBroadcastReceiver。 Firstly I have tried with this code in the manifest: 首先,我在清单中尝试了以下代码:

<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
  <intent-filter>
     <action android:name="com.parse.push.intent.RECEIVE" />
     <action android:name="com.parse.push.intent.DELETE" />
     <action android:name="com.parse.push.intent.OPEN" />
  </intent-filter>
</receiver>

Then, I have tried with this one: 然后,我尝试了以下方法:

<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
  <intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    <category android:name="com.parse.starter" />
  </intent-filter>
</receiver>

As a result, the device have been registered with not pushType and deviceToken, showing the text (undefined) in both fields. 结果,该设备未使用pushType和deviceToken注册,在两个字段中均显示了文本(undefined) When I try to send a push to all the registered devices, Parse throw an error such as: 当我尝试将推送发送到所有已注册的设备时,Parse抛出错误,例如: 解析推送错误

But the installations are currently active. 但是安装当前处于活动状态。 Can anyone help me? 谁能帮我?

Thanks in advance. 提前致谢。

You miss the parse application id and client key (you will find these values on your parse dashboard) 您错过了解析应用程序ID和客户端密钥(您将在解析仪表板上找到这些值)

<application
    ...>
    [...]

    <meta-data
        android:name="com.parse.APPLICATION_ID"
        android:value="xxxxxxxxxxxxxxx" />
    <meta-data
        android:name="com.parse.CLIENT_KEY"
        android:value="yyyyyyyyyyyyyyy" />

    [...]
</application>

and also inside the receiver: 而且接收器内:

<category android:name="com.parse.starter" />

should be: 应该:

<category android:name="you.package.name" />

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

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