Push Notifications on Android Marshmallow

Hi,
I’m implementing push notifications on my app and I’m facing problems for Android 6.0.

I have tried both sending notification from device and from Backendless Console but the result is the same: for devices with Android >= 6.0 seems not working, while with lower versions it works fine.

I put all the header correctly and I followed the tutorial.

Any suggestions?

Thanks in advance

Hi Miriko,
Did you try our sample app https://github.com/Backendless/Android-SDK/tree/master/samples/MessagingService/pushdemo?
Artur

Yes,
the only difference is that I have to sent push notifications to just one user at time.

And to do this I used:
DeliveryOptions deliveryOptions = new DeliveryOptions();
deliveryOptions.addPushSinglecast(id);
deliveryOptions.setPushPolicy(PushPolicyEnum.ONLY);

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” );

Backendless.Messaging.publish(channel, message, publishOptions, deliveryOptions, new AsyncCallback<MessageStatus>() {
@Override
public void handleResponse(MessageStatus response) {

}

@Override
public void handleFault(BackendlessFault fault) {

}

});

Did the broadcast pushes succeed?
Artur

I didn’t try with broadcast, but only with singlecast.
I tried also from Console, but it’s only working with android < 6.0

I also tried to customize the onMessage method (returning false) using the notificationBuilder and I got push notifications working but only when app is foreground and still not working in background.

Please not try to customize, but make sure that pushes work for you on basic setup - only if you enter your sender Id and etc keys to our sample app.

I solved the issue.

The problem was the AutoStart Manager of Asus. If the app is managed by AutoStart Manager, notifications won’t work when is closed.

Thanks