Support Topics Documentation Slack YouTube Blog

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


(roei rosental) #1

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;
}


(Sergey Chupov) #2

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


(roei rosental) #3

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


(Sergey Chupov) #4

Glad it helped :slight_smile: