I though that iOS's local push notifications could be turned off by the user just the same way they do for the classic remote pushes...which is by going to the phone's Settings app, and the > Notifications > My_App_Name, and change the settings from there.
However, I have an app that only uses local pushes, and it's not listed there. Isn't there a way for the user to disable them, unless the developer has created a tailor made settings for that into the app?
Disabling push notifications does not disable local notifications, they are independent of each other.
Related
I'm creating a settings page which allows the user to turn push notifications on and off. Here's my question. If the user Allows Push Notifications at the initial system prompt then later changes their mind and turns the UISwitch to No, I have my off switch action to be:
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
But if you go to the settings app on the phone Allow Notifications is still set to On. I know unregistering them invalidated the token so they won't get any more notifications. But I think they will be confused if the settings app still says they are Allowing Notifications. Do I still need to redirect the user out of the app to settings app to turn OFF remote notifications? Or is there some code I can add that will change Allow Notifications to Off in the Settings app.
you can't change setting app from your app. You have to manually disable it from setting app. as mentioned in another answer you can prompt message to permanently disable (please do it through the settings app).
Second thing if you want to make your server know that don't send notification to this device then
You can do something like this,
if you want to do Inside the app then use one identifier and send it to server according push notification enable and disable button. So, your server side coding use this identifier and work according to that. Like identifier is say it's enable than your server will send notification otherwise not.
You can check that user set enable or disable Push Notifications using following code.
Enable or Disable Iphone Push Notifications
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types == UIRemoteNotificationTypeNone)
// Yes it is..
Hope this will help :)
According to doc
You should call this method in rare circumstances only, such as when a
new version of the app removes support for all types of remote
notifications. Users can temporarily prevent apps from receiving
remote notifications through the Notifications section of the Settings
app. Apps unregistered through this method can always re-register.
I believe what it does is only unregister but do not disable the option of the user settings which the app requested. specially the point Apps unregistered through this method can always re-register
This probably specifies that if you call the register notification method again, user wont be prompted to grant permission as it has already been done before.
I believe you should add a detail sub label to the section of the cell in your app settings screen specifying that the
app will stop receiving notifications, to permanently disable (please
do it through the settings app).
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...
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
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.
I'm using APNs, I have two questions around the use of sounds or buzzing.
Can we just have the device buzz, instead of playing a sound?
Can the user disable sounds via their local system settings for my app? If not, I'd have to build a remote service to let them opt out of sounds for push notifications, and store that option on my server.
I don't know about just buzzing, but yes, the user can disable sounds for push notifications from your app. In the Notification settings for your app there's a switch called "Sounds", just under "Badge App Icon".