HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
240 stars 68 forks source link

HmsPushEvent.onNotificationOpenedApp is getting executed after everytime the app go to background #166

Closed DDAmine closed 2 years ago

DDAmine commented 2 years ago

Description i m using HmsPushEvent.onNotificationOpenedApp to listen to the tap on the notification , after that the user get redirect to another screen based on the payload data , but once the app go in background and then to forground the listener get triggred again Expected behavior just trigger once after the tap on push notification code `this.onNotificationOpenedAppListener = HmsPushEvent.onNotificationOpenedApp( (result) => { const data = JSON.stringify(result) console.log("[onNotificationOpenedApp]: " + JSON.stringify(result)); //console.log('onNotificationOpenedAppListener', result); if (result.extras.page) { switch (result.extras.page) { case 'screen1': navigation.navigate('screen1'); break; case 'screen2': navigation.navigate('screen2'); break; case 'screen3': navigation.navigate('screen3'); break; default: break;

                }
            }
        },
    );`
serdar-can commented 2 years ago

Hi @DDAmine , thank you for your interest in our plugins. Seems like your issue is duplication of #58 . Please check the suggested workaround and reopen the issue if the error persists.