quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

[Bug] DeleteTokenAsync receives a new token immediately in iOS

Open lsw1164 opened this issue 4 years ago • 8 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.23f1
  • Firebase Unity SDK version: 8.6.2
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: messaging
  • Other Firebase Components in use: app, installations
  • Additional SDKs you are using: none
  • Platform you are using the Unity editor on: Mac
  • Platform you are targeting: iOS
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

I've tried to handle push notification on/off in iOS. I expected to delete FCM Token to turn push notification off. Even though TokenRegistrationOnInitEnabled value is False, FCM token is received automatically and immediately after DeleteTokenAsync.

Log

FCM: new registration token received
FCM: Retrieve registration token

So. I could not delete FCM Token. It seems like refresh Token, not Delete. After quit my app, Push Notification is still received.

Plz fix the logic where refresh automatically FCM token. On Android, DeleteTokenAsync works well. It does not fetch the new token immediately after DeleteTokenAsync.

Relevant Code:

Here is my code.

// I've put this pair into my Info.plist:
// <key>FirebaseMessagingAutoInitEnabled</key><false/>
// So, 'Firebase.Messaging.FirebaseMessaging.TokenRegistrationOnInitEnabled' is False.

    Firebase.Messaging.FirebaseMessaging.TokenReceived -= OnTokenReceived;
    Firebase.Messaging.FirebaseMessaging.MessageReceived -= OnMessageReceived;
    Firebase.Messaging.FirebaseMessaging.DeleteTokenAsync();

lsw1164 avatar Nov 30 '21 05:11 lsw1164

Hi @lsw1164,

Thanks for reporting this issue. I was able to observe this behavior using the quickstart. I'll be discussing this with the team, so I'll be marking this as a bug for now. You may refer to this ticket for updates.

paulinon avatar Nov 30 '21 17:11 paulinon

Assign to FCM oncall to take a first look at.

charlotteliang avatar Dec 01 '21 19:12 charlotteliang

@eldhosembabu Any news?

lsw1164 avatar Mar 08 '22 04:03 lsw1164

@paulinon can you help to see if this is reproducible?

charlotteliang avatar Mar 08 '22 17:03 charlotteliang

Hi @chliangGoogle,

I was able to reproduce this issue even with the latest version of the Unity SDK (8.8.0). After deleting the token, a new one is immediately retrieved.

paulinon avatar Mar 09 '22 17:03 paulinon

Please re-assign to @leojaygoogle as he is the one looking into this issue : Internal issue reference: b/211038990

eldhosembabu avatar Mar 30 '22 19:03 eldhosembabu

Any news?

lsw1164 avatar Apr 18 '23 12:04 lsw1164