I am trying to work out the best way to use local notification in background to run a method to display a notification message from core data, based on due date or upcoming weekly and monthly summary report.
There are two options which I have worked out which is NSTimer and UILocalNotification.
With NSTimer i can run scheduledTimerWithTimeInterval every 24 hours in background to check core data before display local Notification to see if it is on due date, weekly or monthly report. I am not sure if this is best solutions or recommendation?
I have read other posts, they suggestion to use UILocalNotification instead. But they are only limited to 64 notifications per app. Thats ok if I use weekly and monthly which total 64 notifications but it won't work after 1 year unless user active the app also I need to display due date's on the day message as well.
I am thinking maybe after a local notification displayed then the app still in background set new next schedule local notification, but I couldn't work this one out so not sure if this is possible?
Any suggestions on this? Thank you in advance.
Related
I'm working on an application notifying Muslims at prayer time. Every day, five different notifications need to be set, notifying the users it's time to pray.
I was able to schedule notifications for one day, but how can I set them every day again? The 5 times need to be changed every day without user interaction or having to open the app.
Is there some kind of callback when the last notification fires, so I can setup notifications for the next day?
One way is to schedule notifications for a week (5*7) if you can get their times correctly , on the basis of that the user may open your app at least once/week
Other way is to make use of background fetch capability where IOS wakes your app to run at any time On the assumption that you re-schedule them for a week from the launch time
My question is very simple but unfortunately I don't find any answer around the Internet. I have an app alerts the user you amount is due based on invoice date in the database. The problem is how can I check periodically while the app in the background. I tried beginBackgroundTaskWithName but it expires after max 10 munites and also I tried back ground fetch but it doesn't work in proper time manner, so may be it takes a day to fetch again.
I really need your help in this.
Thanks in advance
I'm building a reminders app, and been really interested in how to set a reminder to repeat itself every day/every month/every hour.
Basically I want to set something to repeat, even when my app is not running. In my case a local notification fire.
Thanks!
You can set the repeat interval easily using NSCalendarUnits
notification.repeatInterval= NSDayCalendarUnit;
For more calendar units check constants on http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/Reference/NSCalendar.html#//apple_ref/doc/c_ref/NSCalendarUnit
You have to use Local Push Notifications, because when your App is running in background this is the only way Apple would allow you to do something:
Check this for further info: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008194-CH1-SW1
And this is a good tutorial about it: http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
Check out Apple's reference documents here on using UILocalNotifications. I believe that is what you're looking for.
You can utilize UILocalNotifications to show a local notification at a certain time or date, whenever you like.
David Linsin also has a good post on this here.
Good Luck!
What are the options(if any) for precisely timed alarms or alerts from within an iphone app?
My app may need to alert the user in 30 seconds or 5 hours and 23 seconds.
I assume for shorter times I could just use NSTimer, but what is the cutoff point(if there is one) for a timer to be fired within the app?
For longer timed alarms or alerts I've noticed push notifications have been mentioned, can they be timed to the second, are they reliable? Are there other options?
You want Local Notificaitons. They are easy to use, and require no server. You simply set them up, and they fire later wether your app is open or not.
Note that this will require iOS4
Also I believe there is a 60 second window your alert may appear in and you probably dont have percise control down to the second about when they appear. Though I haven't tested this myself.
Take a look at local notifications. You may schedule these using NSDate, which, for example, allows you to schedule an alert in an interval with a precision down to seconds from the current time.
See:
Local and Push Notifications
My app uses badge to count the number of smoked cigarettes in the current day. I would like the app to remove the badge at the midnight, when a new day begins... Is it possible to do that?
I mean, doing that while the app is closed!
Thanks
Interesting question. I don't think there is an elegant way to handle this; even multi-tasking falls short of being able to wake the app to perform a task. The only thing you're allowed to do is schedule a Local Notification, but this is only allowed to increase the badge number - sending a badge number of "0" indicates "no change".
Sorry there isn't a better answer.
andrew
Couldn't you just check, on application startup, if it was already started that day, and if not, remove the badge?