2

its possible to disable push notifications for current app ? i was using example from google GCM notifications. And in app , i want when i logout - disable push notifications . It's possible to do from code or its need disable only on server where push notifications send to me

Regard, Peter.

[upd] Thank you Oleg and also i found a way do this in MessageReceiver

@Override
    public void onMessageReceived(String from, Bundle data) {

        String message = data.getString("message");
        if(notificationsDisabled) {
           // do what u want when notifications variable disabled (without server etc)
        }else{
            // if enabled , show notifications message in status bar or something else
        }
     }

its good way when need update something from server but without push notifications

Peter
  • 2,480
  • 6
  • 39
  • 60

1 Answers1

2

You can manually register your GcmBroadcastReceiver at starup and unregister on exit

Programmatically register a broadcast receiver

Community
  • 1
  • 1
Oleg Khalidov
  • 5,108
  • 1
  • 28
  • 29