Is cancelAllLocalNotifications App specific or for all local notifications - iphone

I'm working a bit with local notifications for the iPhone. All well so far and I'm just seeking confirmation about the cancelAllLocalNotifications.
Would it be correct that firing off a cancelAllLocalNotifications would cancel all SCHEDULED notifications ONLY FOR THIS APP?
E.g other (non scheduled) notifications in this app would still work and scheduled notifications in other apps would still remain. My logical mind say it should be so, just want to be sure.
Thanks

All calls to the local notifications API are restricted to the subset of notifications that your app has created.

cancelAllNotification cancel first 64 notification of the system scheduled by application.

Related

UiLocalNotifcations - malicious or unintended scheduling

After reading the official docs I understand that If I schedule more than 64 notifications the OS only keeps the soonest 64... Out of interest what if an app (malicious or not) scheduled a large number (say 64) of local notications (which could also be potentially repeating) - how could a user cancel these if the app is badly coded and doesn't cancel them itself?? Would a restart destroy any scheduled notifications?
Seemingly a badly coded or malicious app could schedule a large number of repeating and annoying notifications for any date in the future, and if not coded correctly even after app deletion these notifications would still be scheduled?
Any thoughts on this?
A restart will not destroy the notifications, But when the device is turned off when the notification expires, the notification will never show up.
I dont think you're going to find such a bad coded app in the App Store, Apple wouldn't approve an app like that.
If so, could you give us an example?
And if its your own app, you can cancel all the notifications of your app with: [[UIApplication sharedApplication]cancelAllLocalNotifications];

Can I use local notifications for newsstand app subscriptions?

I have a newsstand app that will offer a free subscription that updates daily.
I would like to use push notifications to download the issues in the background.
At first I was considering use UrbanAirship to manage the list of scribers and send out push notifications every day at the same time. Of course this is costly.
Instead would Apple allow me to send local notifications to the app each day at the scheduled time and then the app could go and download the issue in the background, thus avoiding the need for a server to send push notifications or manage a list of scribers or worry about security and certificates etc.
I am not sure about Apple's guideline for this. But I strongly recommend to not try out something like that.
In case your app is not running (not in background) the local notification will not start the download automatically. The Newsstand push notification include the content-available property (with a value of 1) in the JSON payload. Due to this iOS launch your application in background (if not in background) and you can add your content in Newsstand queue for download in background. Once download is complete iOS will close your application. There is no notification alert or any other thing comes which require user to take any action. I think this you cannot achieve through Local Notification.
Other challenges
- How do you make sure the new content is always available when local notification is received .
- How do you figure out what content to download.
Also check out my answer to this question.

Making the app give an alert without running in the background or using notifications?

I'm wondering if it's possible to make an iphone app give the user an alert in a certain time without being run in the background or using notifications?
I see it happening in an app called iPray Pro. It gives an alert for the prayer time even though it's not running in the background or using notifications. I checked under the Setting-Notifications and the app is not there at all.
How is it done?
Scheduled local notifications will trigger even if the app is closed. iPray probably schedules notifications for a given time which are then triggered by the OS without the app having to be open.
Look for Local Notifications in the iOS documentation. They are like push notifications, but don't require a server. They are quite simple API to use too; make a UILocalNotification and use the scheduleLocalNotification: method on UIApplication to add the notification onto the system.
It will then fire in accordance to the fireDate property of the local notification you scheduled.
Local Notifications require iOS4.0 or later.
It is using Local Notifications, not Remote Notifications.

Can I use Push Notification for this

My app should post some message to Twitter at the end of each day at the time X. App might not be running at this time X, but it still has to post that message. I don't want to bother user by everyday asking to do this task.
Can I use Push Notification to silently (without any alert view popup, sound or anything else) do some task in my app in some constant time everyday even if it's not running?
thx
There are three 'notification' mechanisms you can send via push: alerts, sounds, and badge values. The way the push notification works is that on the phone it launches the app and hands over the 'push payload' to it with those values. Even if you turn off all three mechanisms, the OS will still have to launch your app each time, which means the user will get interrupted.
In short, you can't have a push happen silently. I doubt, from a user-experience point of view that Apple will allow things to happen on the phone without the user getting notified somehow.
No.
You can't schedule things to be run by your app on a non-jailbroken iPhone.
The only solution is to have a separately hosted service somewhere to which you push details from your app and that runs the scheduled updates on your behalf.
To do so silently is not up to you. The iPhone device has a configuration in which each app with a Push mechanism has settings where one can specify if they want alerts or not. If set to yes, the text of the alert is displayed as well.
sounds like you are trying to "wake up" your app at a specific time each day to perform some type of task. from what i understand about the iPhone this is not possible. you cannot create a cron job or something that will fire on a time you specify. you can run this on the server side and then push a notification to the user telling them that the message has been posted to twitter.
if you are on a jailbroken phone i feel confident that there is some way to do this.
Given that push notification requires that your server send a notification, why not skip a step and have the server just send the update directly to Twitter on the user's behalf? You can't use push notification to trigger an automatic task on the iPhone like you're asking - the user must take the step of accepting the notification for anything to happen.
if you really want to do it from the phone, you can just declare a "long term" background task should be covered around here (iphone app programing guide) some where..., that way you never go sleep, and you can do what ever you like... :)

How can I run an app at a specified time on the iPhone?

I'm developing a todo list application. I'm looking for any way to alert the user when a task becomes due, even if the app is not running. Is there any way to set the program to run at a specified time w/out user interaction? Or a way to bring up an alert anyway?
Edit: How can I add an item to the calendar?
No, not until the push notification service gets released.
Your best bet right now is allowing users to add reminders to the Calendar - without the push service, there's no notifications without your app running actively.
As has been made very clear by Steve Jobs himself, the iPhone SDK will NOT support background processes. In addition, there is no API to access the calendar on the iPhone.
If these things are important to you, you should file an enhancement request:
Apple Bug Reporter
But even once push is released, that won't enable you to have the application independently alert the user. You would have to run a server that would push notifications to people once a task is approaching due, which means you would have to have everyone's task list synced to your server.