0

Is it possible to query for push authorisations by sending a silent push and have that reported back to my server? I'm assuming silent push does not require push permissions.

Neo
  • 1,181
  • 11
  • 22

2 Answers2

1

Kind of, yes. If you send a silent push notification and your app has not been forced killed, then it could send back an update back to some of your servers saying that it got the notification. Nevertheless, if the user manually quits the app, then those notifications are thrown away by the operating system, so you are not able to tell. Also, you could simply call isRegisteredForRemoteNotifications on your application to check if the device is registered or not.

Update

To be more clearly: It doesn't matter if anything is turned on or off, you can never ever rely on the delivery of a message. The operating system may just delay the delivery, or skip it at all, and you'll never know. At least, not on the server side. Your app truely can check (once it is running again) what kind of notifications it received (it just has to do some bookkeeping), and then ask the server if everything it has is also everything the server send sometime - but this logic has to be implemented by you.

Andreas Oetjen
  • 9,889
  • 1
  • 24
  • 34
  • Thank you. So if the push permissions are turned off the device never receives the notification payload. Is that right? Similarly if background refresh is turned off the device never receives a silent push payload. Correct? – Neo Mar 29 '21 at 05:56
  • Thanks for the clarification. Coming from an Android background I'm trying to understand at what stage does the notification message not get displayed. On Android for 'data' messages the payload gets delivered to the app but it's not shown if the user has turned off notifications. Currently I use this to measure user setting at push delivery. Wonder if something like that was possible on iOS. – Neo Mar 29 '21 at 07:15
1

Silent push notifications don't require push notifications permissions, but they can still be disabled by turning off "background app refresh":

Is Silent Remote Notifications possible if user has disabled push for the app?

Doing background networking requests of any kind while another app is running is a battery intensive thing to do. Many sites tell users to disable background app refresh for apps that use a lot of power. Using this feature unnecessarily could draw attention to your app and have your users disable this permission:

https://www.businessinsider.com/how-to-make-iphone-last-longer-battery-life-tip-2019-7?r=US&IR=T#:~:text=Turn%20off%20Background%20App%20Refresh.&text=That%20way%20the%20next%20time,%22%20and%20select%20%22Off.%22

You could simply check for push notification permissions on the launch of your app and record it there instead. Using silent push notifications to track the users settings is quite an odd thing to do. With everyone interested in what apps are tracking these days, and apple going out of their way to inform users of whats being tracked, doing this might get your app some bad press if it's discovered. I wouldn't install an app doing something like this, as I would be thinking "what else are they going to track while my app is off"

Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56