I'm a bit confused.
It says on many places, that on IOS you can't make your app work if the phone enters standby mode unless you use push notifications.
I did encounter some apps that do succeed this in IPhone 4
(such as ihandy alarm clock http://www.ihandysoft.com/alarm_clock.html)
It even beeped on standby when I was in airplane mode!
Can someone straighten my thought regarding this issue?
There are two kinds of notification in iOS: push notification and local notification.
In your case, the app beeps while airplane mode is on, it might use local notification rather than push notification.
According to http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html, “Apps that receive regular updates from external accessories” can continue to run in the background.
Related
I have an idea for a unique alarm application on the iPhone. But at the moment the only way I can see of initiating the alarm is by leaving the app running all night getting it to poll for the current time. Is there anyway to make an app "wake up" or initiate at a certain time. I know I can use push or local notifications but they require user input before loading my app. Thinking about it I could leave my app on all night, but literally doing nothing (saving battery if not being charged) and then subscribe to a local notification for the alarm itself.
Alternatively, can I make the iPhone run my app when an alarm sounds so I don't have to deal with alarm settings at all?
No, your only option is to use either Local or Push notifications.
I think using event kit framework add event in default iPhone calender.
According to the APNS Reference at Apple.com, an iOS device cannot receive notifications while it's offline / not connection to 3G or WiFi or similar. Yesterday I found an application (Pillboxie) that claims to be able to notify users even though they're offline. I quote:
"In order to use reminder technology that doesn't requre a network connection, Pillboxie will only run on devices running iOS 4.0 or later."
and
"No network connection required!"
Both quotes are copied from the App Description in the App Store.
I have not succeeded to find out how this works and whether it is as reliable as APNS. Does anyone know anything about the offline noficiation service mentioned in the quote above?
Pillboxie uses UILocalNotification to do that.
It is totally implemented on the app itself, without the need of a server side notification or even the internet connection.
You will not be able to use that for sending push notification, from a server to the user device, which is the one that requires the internet connection (wi-fi or 3G).
You can read more about it in Apple's Local and Push Notification Programming Guide
I believe they refer to local notifications and not remote notifications.
Loacl notification are stored locally in the user device. And shot by the iOS itself.
From UIlocalnotification reference:
The operating system is responsible for delivering the notification at the proper time; the application does not have to be running for this to happen. Although local notifications are similar to remote notifications in that they are used for displaying alerts, playing sounds, and badging application icons, they are composed and delivered locally and do not require connection with remote servers.
I'm the developer of Pillboxie. Felipe is correct: Pillboxie uses UILocalNotifications to schedule its reminders. I chose local notifications over push for several reasons. There are pros and cons to either kind. I chose UILocalNotification because it made more sense with the serious medical nature of Pillboxie:
LOCAL NOTIFICATIONS
PROS: Don't need to manage your own server to interface with the APNS. Very reliable, always on time; Works for people who don't have a network connection often (iPod Touch and iPad users); Works when traveling overseas; Automatically adjusts to the current wall-clock time in the current system time zone (if you've set a reference time zone in the time zone property in the UILocalNotification).
CONS: Max of 64 notifications per app; Can only repeat in whole units of either 1 minute, 1 hour, 1 day, 1 week, etc. If repeating, can't set a stop date.
There are actually 2 types of notifications.
Push - generated by APNS require internet connection
Local - generated on device by the application
So the app you are reffering to might be using local notifications. Check docs for more
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.
I have noticed that some apps e.g. Skype run in the background.
I would like to have my app run in the background also, waking up every 1 seconds to update some data and then going to sleep again.
How can I do this?
I gather that NSTimer's do not work in the background.
You can't. Voice-over-IP apps get a special exception for this, basically the system manages a network socket for them and wakes them up if there's data. There's no way to do the same with a timer.
By the way, waking your app every second, your battery wouldn't last half a day.
See Executing Code in the Background
You would need to use push notifications to push information to the app (like the Facebook or Skype app). See this documentation from Apple on how to use push notifications.
Not every second though, that would drain the battery. Other than that, there isn't really a way unless you are running a VoIP app.
I'm making an iPhone app. I can receive UDP messages using AsyncUdpSocket. I want the app running in background, and when receive a message, an UIAlertView is displaying to the user, and he can enter in the app, or ignore the alert.
Is it possible to detect a message when the app is running in background.
Do I need something to execute my code in this method?
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
I saw lot of tutorials, with timer, but I don't need timer to wake up my app. Also I read that's it's possible while playing music, tracking position or using VOIP.
Do I need to play a fake song to keep my app running? or to do something like that?
This app is for security, for example if someone is touching or moving your motorbike/computer/whatever else, your iPhone can alert you and prevents from stealing.
I read other threads similar but didn't find an answer.
Thank you guys for giving me tips, or any help /sample.
You can't run in the background on a non-jailbroken phone without being in one of those three categories of app, and Apple’s really unlikely to approve your app if you use that facility for another purpose. UDP probably isn’t the best solution for this anyway—if your phone leaves the network that the other device (whatever it is) is on, it won’t receive the notification at all, whether or not it’s in the foreground. You’re probably a lot better off using the push notification API.
This seems like a perfect case to use Apple Push Notifications (APN). You app can register to receive the notifications and the phone will alert the user with any combination of badging, messages, or sounds. Sounds like you already have a server that is sending the UDP messages, so incorporating APN should be minimal. Especially if you use a third-party to send the push notification, such as Urban Airship. (I am not affiliated with them, but have used them on a large commercial project.)
By definition, local events are not triggered by receiving a message.