dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
571 stars 467 forks source link

Turn off/on receive notification #147

Closed Jassmin586 closed 4 years ago

Jassmin586 commented 5 years ago

Current behavior: I try to turn off receive notifications by using window.FirebasePlugin.unregister() but nothing change. Notifications still show on device (check on Android).

Expected behavior: Can manage receiving notifications in Android/IOS app. Is it possible?

Environment information

Runtime issue

Android build issue:

dpa99c commented 4 years ago

When you call unregister(), it deletes the existing FCM token. By default, the Firebase SDK will then generate a new one. In order to prevent this - i.e. so you can completely unsubscribe from all notifications - I've exposed the autoinit API functions of the Firebase SDK in the above commit, which allows you to disable autoinit and so prevent a new FCM token being created.

This will be merged to master and pushed out in the next release.