EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Firebase push notifications with broadcast receiver #539

Open krisidmisso opened 6 years ago

krisidmisso commented 6 years ago

Can you please post a sample on how to receive push notifications when I restart the android device? I have built and app using ng template and im trying to register firebase init on device boot_complete:

app.android.registerBroadcastReceiver(android.content.Intent.ACTION_BOOT_COMPLETED,
        function onReceiveCallback(context: android.content.Context, intent: android.content.Intent) {
          let firebase = require("nativescript-plugin-firebase");
          firebase.init({
          ....

          ....
});

But this doesnt work. I get push notifications when i open once the app, but when i restart the device it doesnt get any push notifications (at least without opening the app once again). The firebase code and the broadcast receiver is inside my home.ts constructor() which is accessed every time i open the app.

limsocheat commented 5 years ago

Hi, have you found solution?