I'm using Firebase console to send notifications to users. However I want to let users disable notifications. How can I disable them?
I am able to handle (and stop) notifications through FirebaseMessagingService only when the app is in foreground. But I cannot stop notifications when the app is in background.
Not sure why this happens to you (code snippet maybe?), but there is a heavy weight ultimate solution: define your own c2dm receiver in the manifest and set the priority high (>0) then stop the notification from processing.
GCM messages are processed as ordered broadcasts, so you can stop the processing chain by calling this method:
https://developer.android.com/reference/android/content/BroadcastReceiver.html#abortBroadcast()
If you don't do anything in your receiver then the next receiver will do the processing, which will be the Firebase receiver.
Please note: Firebase is sending push notification for Remote Config changes. So, if you use Remote Config then it is not advisable to suppress any data push.