I have set up everything appropriately, and I am able to successfully register my device and publish a push notification; however, the push notification is not showing up in the push notification center for any of my devices, regardless if the app is closed or not. Coincidentally I am having the exact same problem on iOS still. Anyway, here are the relevant code snippets:
AndroidManifest.xml:
<!-- push notifications -->
<uses-permission android:name="android.permission.INTERNET"/>
<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="trivolution.com.mugclub.permission.C2D_MESSAGE"/>
<permission android:name="trivolution.com.mugclub.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<application
android:name=".API.ParseApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".Controllers.LoginActivity"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!--Push notification receiver -->
<receiver android:name="com.backendless.push.BackendlessBroadcastReceiver" 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="trivolution.com.mugclub"/>
</intent-filter>
</receiver>
<!--End Push notification receiver -->
...
In ParseApplication (where I am initializing backendless, registering my device, and registering Parse (being used for something else, still in the process of migrating):
Backendless.Messaging.registerDevice("70291520888", "default", new AsyncCallback<Void>() {
@Override
public void handleResponse(Void response) {
Log.i(TAG, "Successfully registered device");
}
@Override
public void handleFault(BackendlessFault fault) {
Log.i("Register", fault.getMessage());
}
});
Lastly, when sending a push notification, this is working too:
PublishOptions publishOptions = new PublishOptions();
publishOptions.putHeader( "android-ticker-text", "You just got a private push notification!" );
publishOptions.putHeader( "android-content-title", "This is a notification title" );
publishOptions.putHeader( "android-content-text", "Push Notifications are cool" );
DeliveryOptions deliveryOptions = new DeliveryOptions();
Date publishDate = new Date( System.currentTimeMillis() + 5000 ); // add 20 seconds
deliveryOptions.setPublishAt( publishDate );
Backendless.Messaging.publish((Object) title.getText().toString(), publishOptions, new BackendlessCallback<MessageStatus>() {
@Override
public void handleResponse(MessageStatus response) {
if(response.getStatus() == PublishStatusEnum.SCHEDULED) {
Toast.makeText(getApplicationContext(), "SWEET", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), response.getStatus().toString(), Toast.LENGTH_SHORT).show();
}
}
});