Battery Low Warning Handling / remain active with screen lock

I appreciate your response; however, I think you may have misunderstood. I do handle suspend/resume events without issue. The problem is, I don’t want the app to suspend at all when the battery warning appears (which it does), nor do I want it to suspend when the screen lock is activated. I don’t want the suspend event to fire. My app is designed to be ignored until an audio notification is triggered. If the app suspends, then the audio notification will not be triggered. I know this is possible natively with iOS code, but it seems impossible with Corona. [import]uid: 87249 topic_id: 36330 reply_id: 144367[/import]

It’s going to suspend when the device goes to sleep. Unless you are Apple and have access to backgrounding (using Objective C) that they don’t give to mortals, you’re not going to be able to stay live while the phone is locked/sleeping. There are a hand full of very specific things they let a sleeping app do which includes play music, check the GPS periodically, download newstand content, and a few others. See:

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

and click on the uiBackgroundModes link. If you’re not doing one of these, there is no running in the background or you’re Apple and can do what you want.

Apple is going to suspend your app on low battery warnings. There is nothing Corona Labs can do about this:

http://www.ios-developer.net/iphone-ipad-programmer/development/alert-view/system-alerts

Since you’re not Apple, the best thing you can do is to update your visual timer to account for the time the app was suspended.

You mentioned an audio alert… I don’t know if this is the same as playing music in the background or not. That is one of the things an app can continue to do, but I don’t know if that’s the case here.
[import]uid: 199310 topic_id: 36330 reply_id: 144369[/import]

Weird. Basically, my app displays a countdown timer, so there’s a timer running, and the display is updating, and when the countdown has completed, an audio file plays.

Here is an example of an iOS app that can do exactly that – Meditation Timer: https://itunes.apple.com/us/app/meditation-timer-free/id515571863?mt=8

It’s a free download – feel free to try it out. I’ve tested this particular app myself, and when the low battery alert happens, the alert still shows up on screen, but without vibration and you can still see the meditation timer counting down in the background. If you ignore the battery warning, the app still does its audio & vibration notifications. Also, this app will continue if the screen lock has been activated, and it will still provide its audio & vibration notifications. So it must be possible. This is exactly what I need my app to do.
[import]uid: 87249 topic_id: 36330 reply_id: 144376[/import]

I think they might be doing it with local notifications – that should take care of the screen lock issue. I wonder if it’ll work with the battery alert. I’ll give it a shot.

[import]uid: 87249 topic_id: 36330 reply_id: 144377[/import]

Using local notifications works well for when the screen is locked and the app is suspended. However, when the battery alert is displayed, the app is suspended; however, the notifications don’t seem to fire.

Actually, I’m having trouble getting the notifications to fire at all when the app is in the foreground – the notification listener fires, so I can handle that, but the notification alerts (audio, etc) don’t fire. Just using the local notifications sample code – am I missing something?

[import]uid: 87249 topic_id: 36330 reply_id: 144425[/import]