I am using push notifications in my application using Firebase.
How do we know whether or not the user has enabled the notification service in his settings for our app?
I am using push notifications in my application using Firebase.
How do we know whether or not the user has enabled the notification service in his settings for our app?
As far as I know, there's no way you can alter push notification
on the client-side
,
unless you can make sure the app is running so you can filter out the notification
.
But you can do some workaround on your backend. You can collect all the client
token
on your backend, and save whether the client is turning the push notification on or off. In this way, you can send the push notification only for the client who has enabled push notification.
You can know the Notification settings of the app by using the below code.
UNUserNotificationCenter.current().getNotificationSettings { settings in
print(settings.authorizationStatus.rawValue)
}
settings
has whole lot of information about the notification permission of the app. Please find the Apple document here