Events triggers multiple times. - Continuation of Issue 50
See original GitHub issueIt is a continuation of issue 50. URL - https://github.com/CrossGeeks/FirebasePushNotificationPlugin/issues/50
My code setup is same as explained in issue 50.
I have register notification events in App class constructor. These events trigger multiple times on successive notification clicks. As these events are register every time I click on notification, it calls App class constructor using LoadApplication method in MainActivity in Xamarin.Android. I have tried removing registered event and then register again but still event called multiple times. 😦
Below code I tried but did not work.
public App()
{
InitializeComponent();
MainPage = new MainPage();
try
{
CrossFirebasePushNotification.Current.OnTokenRefresh -= FCM_OnTokenRefresh;
CrossFirebasePushNotification.Current.OnTokenRefresh += FCM_OnTokenRefresh;
CrossFirebasePushNotification.Current.OnNotificationReceived -= FCM_OnNotificationReceived;
CrossFirebasePushNotification.Current.OnNotificationReceived += FCM_OnNotificationReceived;
CrossFirebasePushNotification.Current.OnNotificationOpened -= FCM_OnNotificationOpened;
CrossFirebasePushNotification.Current.OnNotificationOpened += FCM_OnNotificationOpened;
}
catch (Exception ex)
{
var msg = ex.Message;
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Solved: A Event is created multiple times though it is onl...
A Event is created multiple times though it is only supposed to do it once ... The flow is triggered when an event...
Read more >jQuery click events firing multiple times - javascript
I'm attempting to write a video poker game in Javascript as a way of getting the basics of it down, and I've run...
Read more >Triggers - AWS Glue
Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires. Predicate structure....
Read more >Using Trigger Exceptions In Google Tag Manager
Multiple Triggers · A Tag will fire if ANY of the Triggers evaluate to TRUE. · A Tag will only fire ONCE per...
Read more >How a web session is defined in Universal Analytics
The reason is that Sessions is not incremented in cases where a session only consists of non-interaction events. In contrast, New Users is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same here on Android, using the latest version of the plugin and all of the above workarounds.
Steps to reproduce:
OnNotificationOpened
event will be fired twiceIf I exited and reopened the app for the third time, the
OnNotificationOpened
event will be fired three times. The number of app reopen is the number of the event fired.@ravikanasagra1 I do not know if you noticed they reference this issue on issue 14 In case you have not seen it and to help you is not you taping multiple times 😃 , what happens is that everytime you tap the notification a new instance of App gets created handling the event again, and that will happen everytime you open a new one. If you notice the more notifications you open, the more times you will see your event reaching.
This is the solution:
I was having the same issues than you and I was able to fix it by following those steps. Let me know if it fixes the your problem or if you need more help. If you had already figured it out, hope it helps someone else.