question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Notification shown each time I open the app

See original GitHub issue

Hi everyone, I’m using code presented by Jen looper to recieve FCM messaging. in android each time I open the app, an empty dialog.alert jumps even though there is not FCM message sent by Firebase, any idea please ?

here is a snapshut of the code, thanks in advanced:

setTimeout(function () {
  let firebase = require("nativescript-plugin-firebase");
  firebase.init({
    onPushTokenReceivedCallback: function (token) {
      console.log("Firebase push token: " + token);
    },
    onMessageReceivedCallback: function (message) {
      dialogs.alert({
        title: "Push message: " + (message.title !== undefined ? message.title : ""),
        message: JSON.stringify(message),
        okButtonText: "W00t!"
      });
    },
    //persist should be set to false as otherwise numbers aren't returned during livesync
    persist: false,
    //storageBucket: 'gs://yowwlr.appspot.com',
    onAuthStateChanged: (data: any) => {
      console.log(JSON.stringify(data));
      if (data.loggedIn) {
        BackendService.token = data.user.uid;
      }
      else {
        BackendService.token = "";
      }
    }
  }).then(
      function (instance) {
        console.log("firebase.init done");
      },
      function (error) {
        console.log("firebase.init error: " + error);
      }
  );
}, 3000);

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rkhayyatcommented, Nov 28, 2017

@souly1 thanks for your awsome reply 😃, I 'll try your work around and get back to you with the result. Thanks again

0reactions
souly1commented, Nov 28, 2017

Hi @rkhayyat , I’ve noticed in our app that the event ‘onMessageReceivedCallback’ is called each time app returns from background, so in your code should show alert each time. Simple workaround for us in the meantime was to look and the message data structure which is different than an actual push notification in our system, so if not in correct structure ignoring.

Hope this helps, Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control notifications on Android - Google Support
Open your phone's Settings app. · Tap Notifications and then · Under "Most recent," find apps that recently sent you notifications. To find...
Read more >
Use notifications on your iPhone or iPad - Apple Support
Tap a single notification to open the app that it's from. Tap a group of notifications to view all recent notifications from that...
Read more >
Notification is showing every time I open my application
Notification is showing every time when I opens the application. I searched alot to this bug but I cant rectify this bug.. This...
Read more >
Turn App Notifications On / Off - Android - Verizon
1. From a Home screen, do one of the following: Swipe screen then navigate: Settings > Apps & notifications > App info.Navigate: Settings...
Read more >
Change notification and quick settings in Windows
Change your action center settings at any time from the Settings app. Select Start , then select Settings . Select System > Notifications...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found