无法从 Parse.com 发送推送 [英] Can't send push from Parse.com
问题描述
我的应用中有一个带有 Parse 的项目,但我已经更改了项目(以及密钥)并且我的推送(测试或正常)没有从 Parse 发送.
I had a project with Parse in my app, but I've changed the project (and so the keys) and my pushes (test or normal) doesn't get sent from Parse.
当我尝试发送它们时,我收到通知,它将被 2 个收件人接收:
When I try to send them I'm notified that it's going to be received by 2 recipients:
我的客户端推送已启用:
My Client push is ENABLED:
虽然我认为不需要,但我已经获得了 GCM 凭据:
Although I think it's not needed, I've got my GCM credentials:
- 我尝试在 Android 上扩展自定义
ParsePushBroadcastReceiver
并记录onReceive
- 我已尝试在发布和调试时签名.
- 我尝试过使用 Wi-Fi、3G 和 4G.
- 我尝试清除数据、卸载应用、重新启动.
我对 AndroidManifest.xml 的权限是:
My permissions on AndroidManifest.xml are:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="taggie.me.permission.C2D_MESSAGE" />
<uses-permission android:name="taggie.me.permission.C2D_MESSAGE" />
我的申请是:
<application
android:name=".MainApplication"
android:allowBackup="true"
android:icon="@drawable/logo_help"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
代码是:
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "YBi4ki505TcwKSNEIW7gkFCdWvjHC9yNJmrZHBGR", "APwUw3laazYRhvkSRwZZqpxsROUjH5jWP6QzeHiq");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
我的 AndroidManifest.xml 的其余部分是:
and the rest of my AndroidManifest.xml is:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
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="taggie.me" />
</intent-filter>
</receiver>
<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>
<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="id:10321_and_the_rest_of_my_number" />;
但是问题就在这里
我没有收到通知,当我发送通知时,我可以看到:
I don't get notifications, and when I send them I can see this:
有人在开枪之前有什么线索吗?谢谢:)
Does anyone has a clue before shooting myself? Thank you :)
这太不可思议了,我曾尝试将 apk 发送给我的一位朋友……他收到了推送通知,但我没有!为什么有可能?
This is incredible, I've tried to send the apk to one friend of mine... and he gets the push notifications but I don't! why could it be possible?
我刚刚打开了端口 8253,因为我看到了一些报告此问题的帖子,但它仍然无法正常工作.:'(
I've just opened the port 8253 as I've seen some posts reporting this, but it's still not working. :'(
推荐答案
主要问题是我在使用 Genymotion.
The main problem is I was working with Genymotion.
作为模拟器,推送通知应该到达或根本不到达,但它们有时会到达.我无法解释为什么.
Being a simulator, push notifications should ARRIVE or NOT ARRIVE at all, but they were arriving sometimes. I can't explain why.
这篇关于无法从 Parse.com 发送推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!