CrossGeeks/FirebasePushNotificationPlugin

OnTokenRefresh method only fires every second debug session, but token has renewed on Firebase

KevinNelHowell opened this issue ยท 1 comments

๐Ÿ› Bug Report

I noticed this on a project I am working on and decided to start a clean Xamarin Forms project and test if I get the same results there. I used your sample as a reference and confirmed that every second time I run the App on an Android Emulator or Android Device the OntokenRefresh method is not triggered, yet Firebase has assigned a new token. I tested this using a Postman send command which sends a command with data payload to the mobile device. FCM reports "error": "NotRegistered" on the second restart. I then simply restart the App in the debugger and then the OnTokenRefresh is triggered and the App receives notifications from Postman event. I have tested it in Release mode (with initialised set to initialise the token on every start) and the same happens.

Expected behavior

The Token is supposed to initialise every time I restart the App in Debug mode, but it doesn't trigger the OnTokenRefresh command although the refresh has occurred at Firebase

Reproduction steps

I start a new Xamarin Forms project and copied the code as per your sample in this repository. Exactly every second time I run the App the OnTokenRefresh code is triggered.

Configuration

I am running Visual Studio 2022
NetStandard 2.0.3
Plugin.FireBasePushnotification 3,4,35
Xamarin.Forms 5.0.0.2196

Platform:
Xamarin Forms
Android

I have found the answer to this issue thanks to this comment
from #320 (comment)