firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
825 stars 428 forks source link

[Bug] DeleteTokenAsync receives a new token immediately in iOS #1197

Open lsw1164 opened 2 years ago

lsw1164 commented 2 years ago

[REQUIRED] Please fill in the following fields:

[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();
paulinon commented 2 years ago

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.

charlotteliang commented 2 years ago

Assign to FCM oncall to take a first look at.

lsw1164 commented 2 years ago

@eldhosembabu Any news?

charlotteliang commented 2 years ago

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

paulinon commented 2 years ago

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.

eldhosembabu commented 2 years ago

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

lsw1164 commented 1 year ago

Any news?

lsw1164 commented 1 month ago

Hello? When can I expect it to be done?