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.

onNotification not fired when app is minimised

See original GitHub issue

In my project, onNotification function works fine when the app is in foreground. It even gets fired when the app has been closed and user opens the app by clicking on the notification. But when the app is minimised, on receiving notification and clicking it, the app opens but onNotification function is not being called. Here is my app.js:

export default class App extends Component{  
    constructor(props) {
      super(props);
      this.state = {
        senderId: appConfig.senderID,
        notiType: 'default'
      };
      this.notif = new NotifService(
        this.onRegister.bind(this),
        this.onNotif.bind(this),
      );
    }
    onRegister(token) {
        this.setState({registerToken: token.token, fcmRegistered: true});
    }

    onNotif(notif) {
        console.log(notif);
        if(notif.type != undefined) this.setState({notiType: notif.type});
    }
    componentDidMount(){
        this.notif.configure(
            this.onRegister.bind(this),
            this.onNotif.bind(this),
            this.state.senderId,
        );
    }
    
    render(){
            return (
                <NavigationContainer>
                {StackScreen(this.state.notiType)}
                </NavigationContainer>
            );
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

1reaction
s-z-scommented, Apr 30, 2020

Ok thanks a lot! Atleast this one got fixed automatically. 😅 I will close this issue.

0reactions
amirulasrofcommented, Oct 16, 2020

Same issue happen to me as well. When app is minimized, onnotification is not triggered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onNotification() is not fired when app is killed - Stack Overflow
I am not positive but when I remember correctly killing (alias force closing) an app disables the onNotification functionality in Android ...
Read more >
Events | Notifee
The application is running & is in not in view (minimized). ... DELIVERED event is not fired for trigger notifications when the app...
Read more >
awesome_notifications | Flutter Package - Pub.dev
A complete solution to create Local and Push Notifications, customizing buttons, images, sounds, emoticons and applying many different layouts for Flutter ...
Read more >
Receive messages in a JavaScript client - Firebase - Google
Handle messages when your web app is in the foreground ... or in the background, hidden behind other tabs, or completely closed. ......
Read more >
Handling click on notification when app is closed/minimized ...
So when the app is open and in the foreground, there is no push notifications ... The event is triggered, though the notification...
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