Disable Firebase Notifications in Unity

时间:2018-12-19 11:12:49

标签: c# firebase unity3d firebase-cloud-messaging

I integrated Firebase notifications with Unity 2018.3 and all is working. The app receives notifications while in foreground or background.

I want to allow the user to disable/enable notifications, but I can't find how.

I could ignore the notifications (do nothing in their OnReceive callback), but the user will still get notifications when the game is in the background. I tried removing the callbacks but that didn't work.

if (VNotifications)
         {
             Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;
             Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;
         }
         else
         {
             Firebase.Messaging.FirebaseMessaging.TokenReceived -= OnTokenReceived;
             Firebase.Messaging.FirebaseMessaging.MessageReceived -= OnMessageReceived;
         }

0 个答案:

没有答案