我无法通过Parse从我的应用程序发送推送。我检查了每个设置:
毕竟,我想发送推送,但我不能这样做。我开始调试这个问题。
首先,我检查了推送通知是否已发送。
ParsePush push = new ParsePush();
push.setChannel(channel);
push.setMessage(message);
push.sendInBackground(new SendCallback() {
@Override
public void done(ParseException e) {
Log.d("SEND PUSH", (e == null) ? "SUCCESSFULL": "FAILED");
}
});
但是这个方法返回" SUCCESSFULL"。所以它必须是好的。但是在Parse管理页面和设备上它没有显示。
我很好奇,我可以接收推送通知,所以我从解析管理页面向我的频道发送了一个推送通知。这很有用。
所以我认为,问题出在发送方法或清单中:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="conversation.laszlomagyar.hu" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<!-- parse permissions -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="conversation.laszlomagyar.hu.permission.C2D_MESSAGE" />
<permission android:protectionLevel="signature"
android:name="conversation.laszlomagyar.hu.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name=".ApplicationObject">
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.parse.push.notification_icon"
android:resource="@mipmap/ic_launcher"/>
<activity
android:name=".ui.StarterActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.Activity"
android:label="@string/rooms"
android:screenOrientation="portrait"/>
<activity android:name=".ui.Activitytwo"
android:label="@string/app_name"
android:screenOrientation="portrait"/>
<activity android:name=".ui.Activitythree"
android:label="@string/create_room"
android:screenOrientation="portrait" />
<!-- parse stuffs -->
<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.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>
<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="conversation.laszlomagyar.hu" />
</intent-filter>
</receiver>
</application>