How to prevent push notifications from being shown when App is in foreground

I do know to identify the App state, but when i return false from MyPushService (see code below), it still shows the notification in Android notification center.
@Override
public boolean onMessage( Context context, Intent intent )
{
return false;
}

Hi Roei,

Have you also declared MyPushReceiver class and registered it in AndroidManifest.xml? It’s described here in the doc: https://github.com/Backendless/Android-SDK/blob/master/docs/push.md

Hey Sergey, I have declared and implemented the MyPushReceiver class. The problem was declaring the BackendlessPushReceiver too, according to the documentation.
Thanks for your quick reply.
Roei

Glad it helped :slight_smile: