Some background information
I'm using the silentPush feature (didReceiveRemoteNotification
) to keep the iOS app synced with other platforms and my backend.
So just to be sure, that the user enabled Background Refresh in his iOS settings, I'm checking the devices settings with the following code:
// Check Background Refresh
switch UIApplication.shared.backgroundRefreshStatus {
case .available:
// iOS background refresh is enabled in iOS settings
// -> No need to ask user for permission
break
case .denied:
// iOS background refresh is disabled in iOS settings
// here is my code to notify user to enable his background refresh iOS settings
break
}
According to the Apple documentation (https://developer.apple.com/documentation/uikit/uiapplication/1622994-backgroundrefreshstatus) there is a property backgroundRefreshStatus
, which indicates, if the user has enabled the background services -> This is exactly the code I implemented above.
This property reflects whether the app can be launched into the background to handle background behaviors, such as processing background location updates and performing background fetches. If your app relies on being launched into the background to perform tasks, you can use the value of this property to determine if doing so is possible and to warn the user if it is not. Do not warn the user if the value of this property is set to restricted; a restricted user does not have the ability to enable multitasking for the app.
The following phrase is now interesting in my case
you can use the value of this property to determine if doing so is possible and to warn the user if it is not
I had a look into the iOS background refresh system settings and found 3 possible values, which the user can set:
Now my question:
I would like to ask the user for background service permission, if the settings are either on off
or only on Wifi
(see red rectangle). According to Apples documentation, there is only the possibility to check the general settings -> either on or off. Is there any possibility to check it like I mentioned it on the screenshot?