Push Notifications for iOS - ios

When I implement "Push Notifications" functionality in my application, in the settings of the phone the user can choose if he want to have the push notifications enabled or disabled.
Is it possible that I disable this functionality? My application has push notifications by default disabled and the user can subscribe to various kinds of events to get push through the app.
So this "general", enable/disable functionality is really a pain for the architecture of my app , my databases etc.
Also I support 4 different platforms of mobile devices, that don't have this functionality. So I cant have it only for 1 platform..
Is it possible not to be there?

You cannot prevent the user from disabling/enabling Push Notifications. Apple is pretty clear in regards to actions like this. They do not want a developer to be able to restrict any basic iOS functionality.
You say that your app has push notifications disabled by default. Why are you concerned about this? Also, handling push notifications in an app is actually somewhat easy and does not require much code at all.

you can not do it at app end but you can put a check on server side to send the notification only on those devices on which the applicable users are logged in.
try this it may help you.

If you use Apple's Push Notifications you cannot stop the user from disabling display of your notifications.

This should really be more of a minor inconvenience than a big problem.
If user had disabled notifications from outside your app (in device settings) you can simply perform the same actions as if he did it inside your app.
On how to check if notifications for your app are enabled or not check here: Determine on iPhone if user has enabled push notifications
As for not allowing the user to disable notifications within device settings: it's a no-go.

Related

Read iOS push permissions via silent push

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.
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.
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"

UNUserNotificationCenter silently deliver local notification without a Banner

Hei,
I am trying to implement a feature (iOS 12+) which allows to deliver notifications silently without showing the Banner alert, but delivering it directly to the user's notification center. A bit like the new feature where a user can select that he wants to receive notifications from a specific app quietly.
I checked out the new APIs (and the old ones), but I could not find a way to solve that.
I also tried to replace existing notifications by using the same identifier, but this will also present a banner.
As my app uses notifications which may help the user, but should not interrupt him I would like to control which notifications are delivered like that and which may be prominent.
If this is currently not possible, I will create feature request for that.
Regards,
Alex

Do Push Notifications with content-available work for users that have disabled Push Notifications?

I'm looking into reliable ways of updating an iOS app with content of critical importance, when instructed to do so by a server.
This would have to trigger regardless of the state of the app (foreground, background, not running, etc). Most sources seem to indicate that Push Notifications with the content-available: 1parameter are able of doing this.
My question is, what happens if the user either presses Cancel when prompted to allow the app to receive push notifications, or turns them off afterwards ? Is he only not going to receive alerts anymore, or will the push notifications be entirely ignored (including the content update) ? And if so, is there any other iOS feature that would reliably allow me to update the app's content (regardless of app state and without the user being able to disable it) ?
This is about iOS 7 and above.
If user disallows the push notifications , you can not send them the notifications forcefully.
What kind of data you want to update afterwards?
Most of the data can be changed dynamically by web services...

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

In my settings tabbar:
I have a feature specific switch which can be turned OFF or ON based on API response.
From website only admin is authorized to turn ON/OFF.
I can make /user API call everytime on settings tap to check the current settings for the user but there are couple of disadvantage like if user is already on setting then it will not update the UI and calling api everytime on settings tap doesn't sounds a perfect solution.
I think better solution is to send a silent push notification which i can use to make the API call to update the settings UI whenever needed.
But if user has disabled the push notification will I still receive silent push ? What is the recommended approach to handle such situations ?
Short answer, yes
The exciting new opportunity for app developers in iOS 8 is that Apple will now deliver “silent” pushes even if the user has opted out of notifications. Also, “silent push” is no longer just for Newsstand apps. Every app can take advantage of this ability to refresh content in the background, creating the most up-to-date, responsive experience possible, the moment the user opens the app.
Although...
Users still have the ability to switch off your app’s ability to process a “silent push” by means of the “Background App Refresh” control. Even though Apple Push Notification service (APNs) will deliver a push marked “content-available” to your phone, the OS will not wake up your app to receive it, effectively dropping it on the floor. However, opting out of “Background App Refresh” is a lesser-known capability not directly associated with Notifications. You don’t access this preference in your Notifications Settings--it’s located under General > Background App Refresh screen.
Keep this in mind when building your application.
Source:
https://www.urbanairship.com/blog/watch-list-ios-8-opt-in-changes
This matrix might help. At left hand side, it shows if "didReceiveRemoteNotification: " method will get called or not. Other two columns is related to setting app. Settings -> YourApp. If yourApp supports Notifications and background app refresh. Look into matrix to check when you app will receive silent push.
Other answers are good. But they are not official answers.
The official answer is in What's New in Notifications WWDC 2015 video:
Silent notifications are enabled by default. The user does not need to
approve your -- does not give permission to your app to use them, and
you can just start using them without asking the user for permission.
But silent notifications are the mechanism behind background app
refresh. At any point you know that the user can go in settings and
disable them. So you can't depend on them always being available. You
don't know if the user the turn them off, and you are not getting a
notification anymore. This also means that silent notifications are
delivered with the best effort. That means that when the notification
arrives on the user's device, the system is going to make some
choices.
For more see this image and this answer

Whose Job is it to Display or Hide Push Notification on iOS?

I have a beta app that people are testing. Some are saying that they "turned off" push notifications in the Settings app but they are still getting notifications. My assumption is that if the user turned off notifications for my app via the Settings app, then I could still send notifications to their device and the notifications would not be displayed.
Is there a problem with how I am handing this? I have been searching through the Push Notification documentation but haven't found anything about this.
Thank You.
It's the users job to allow them.
It's the systems job to fetch/display them.
It's the servers job to send them.

Resources