question

MGGD avatar image
MGGD asked

Enable/Disable push notifications

Hello,

How to allow the user to Enable/Disable receiving push notifications?

Currently, I am using Push Notifications with Firebase, but Firebase doesn't allow disabling the notifications. The user will always receive notifications after they registered, even if the app is in the background.

I am considering using Playfab push notifications, but first, does it support disabling/enabling the notifications from code, so I can allow the user to control that?

Thank you.

Push Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

In terms of iOS/Android development issue, If you are receiving your own notification( not system level notification), you can set flags at onMessageReceived function so that users can manually enable and disable notifications. The client is still receiving notifications at background while the flags prevent it from showing up at player’s device. If the Notification is from GCM/FCM, you need to unsubscribe to restrict your notification, for example,

FirebaseMessaging.getInstance().unsubscribeFromTopic("YourTopic");

For more details, please see https://firebase.google.com/docs/cloud-messaging/android/receive

In terms of PlayFab endpoint solution, if you have created scheduled Tasks, such as daily news, to send ‘notifications’ to player accounts, we recommend you to use Player Segments. You can categorize players and set a couple of rules to trigger Cloud Scripts. Please see Player Segmentation here. Additionally, please also check the answers about push notification that Brendan provided in this thread.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

MGGD avatar image MGGD commented ·

That's what I did. It seems FCM has no way -yet- to easily unsubscribing the device, so using topics is the way to go.

Thanks for the detailed answer.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.