I have ran my application on two devices, on the screen to send push notifications it tells me there will be 2 recipients. However when I send the notification nothing appears on the phone.
on the screen that shows the list of push notifications sent I can see my notifications, with the target "Everyone" and the "Pushes Sent" field is "0"
here is my application class;
import android.app.Application;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseInstallation;
import com.parse.ParsePush;
import com.parse.PushService;
import com.parse.SaveCallback;
/**
* Created by andrew on 31/07/15.
*/
public class android extends Application {
@Override
public void onCreate() {
Parse.initialize(this, "KEY HERE", "KEY HERE");
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
ParseInstallation.getCurrentInstallation().saveInBackground();
ParsePush.subscribeInBackground("", new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
PushService.setDefaultPushCallback(this, LoginActivity.class);
System.out.println(ParseInstallation.getCurrentInstallation().toString());
super.onCreate();
}
}
and here is my manifest;
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.app.android" >
<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.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<permission android:protectionLevel="signature"
android:name="com.my.app.android.permission.C2D_MESSAGE" />
<uses-permission android:name="com.my.app.android.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/launcherid"
android:label="mEnquirer"
android:name=".android"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" >
<!-- Activitys where here -->
<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" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="com.my.app.android" />
</intent-filter>
</receiver>
</application>
</manifest>
I managed to fix this, turns out I had changed the package name in my manifest at some point and this was confusing parse.
I created a new project and copied my code to it and everything works now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.