Receive push notification when app in foreground after disable notification permission in settings

Although I disable notification permission in setting, still receive push notification when app in foreground

AppDelegate::application(_:didReceiveRemoteNotification:fetchCompletionHandler:)[L:------------------didReceiveRemoteNotification [AnyHashable("aps"): { alert = { body = "Push payload body"; subtitle = "Test push notification"; title = "Push Hero"; }; }]------------------]

Answered by Engineer in 792192022

The notification permission in settings is meant to control the visual behavior of notifications. If it is disabled the app will not be able to show notifications.

But in the case of app being in the foreground and also for notifications with the content-available flag in the payload, these are considered signals to the app that there is new content to be fetched or an action can be taken upon receipt. While content-available notifications are usually throttled if your app is in the background or not running, if it is already in the foreground the system passes the information in case you would like to refresh your content automatically.

The notification permission in settings is meant to control the visual behavior of notifications. If it is disabled the app will not be able to show notifications.

But in the case of app being in the foreground and also for notifications with the content-available flag in the payload, these are considered signals to the app that there is new content to be fetched or an action can be taken upon receipt. While content-available notifications are usually throttled if your app is in the background or not running, if it is already in the foreground the system passes the information in case you would like to refresh your content automatically.

I do not set content-available

We'd have to see some system logs to understand what exactly is going on with your app, then.

The best way would be to submit a complete Feedback Report regarding this issue using Feedback Assistant (https://feedbackassistant.apple.com).

First, be sure to test on the most recent version of the OS available.

In your bug report, we request that you create a sysdiagnose to assist with the investigation of the problem. Please go to https://developer.apple.com/bug-reporting/profiles-and-logs/ and follow the instructions for APNS (Apple Push Notification Service) to install a logging profile on the device exhibiting the issue BEFORE reproducing the issue.

Then, once the logging profile is installed:

  • reproduce the problem, by sending a notification or notifications that exhibit the issue
  • report the exact time and date (including time zone) of these pushes
  • the public IP address of the server used to send the pushes
  • your push topic (apns-topic header value)
  • your app’s Bundle ID
  • the device token
  • full contents of the headers and the payload
  • any logging you have from the server side that shows the interaction with it and APNs.

Once the issue is reproduced, please follow the instructions at the above link to trigger a sysdiagnose, collect the logs and attach it to your bug report.

If you post the Feedback ID here, we can pair this thread with it.

Receive push notification when app in foreground after disable notification permission in settings
 
 
Q