/** * Called if InstanceID token is updated. This may occur if the security of * the previous token had been compromised. Note that this is called when the InstanceID token * is initially generated so this is where you would retrieve the token. */ public override void OnTokenRefresh() { // Get updated InstanceID token. var refreshedToken = FirebaseInstanceId.Instance.Token; PushNotificationManager.SecureStorage.SetValue(PushNotificationManager.TokenKey, refreshedToken); // CrossPushNotification.Current.OnTokenRefresh?.Invoke(this,refreshedToken); PushNotificationManager.RegisterToken(refreshedToken); System.Diagnostics.Debug.WriteLine($"REFRESHED TOKEN: {refreshedToken}"); }
public override void OnNewToken(string refreshedToken) { var editor = Android.App.Application.Context.GetSharedPreferences(PushNotificationManager.KeyGroupName, FileCreationMode.Private).Edit(); editor.PutString(PushNotificationManager.TokenKey, refreshedToken); editor.Commit(); // CrossPushNotification.Current.OnTokenRefresh?.Invoke(this,refreshedToken); PushNotificationManager.RegisterToken(refreshedToken); System.Diagnostics.Debug.WriteLine($"REFRESHED TOKEN: {refreshedToken}"); }
/** * Called if InstanceID token is updated. This may occur if the security of * the previous token had been compromised. Note that this is called when the InstanceID token * is initially generated so this is where you would retrieve the token. */ public override void OnTokenRefresh() { // Get updated InstanceID token. var refreshedToken = FirebaseInstanceId.Instance.Token; if (!string.IsNullOrEmpty(refreshedToken)) { ((PushNotificationManager)CrossPushNotification.Current).Token = refreshedToken; } // CrossPushNotification.Current.OnTokenRefresh?.Invoke(this,refreshedToken); PushNotificationManager.RegisterToken(refreshedToken); System.Diagnostics.Debug.WriteLine($"REFRESHED TOKEN: {refreshedToken}"); }
public override void OnNewToken(string p0) { ((PushNotificationManager)CrossPushNotification.Current).Token = p0; PushNotificationManager.RegisterToken(p0); System.Diagnostics.Debug.WriteLine($"REFRESHED TOKEN: {p0}"); }