Scheduling Notifications On Applicationsuspend: Don't Fire If Device Sleeps

If I set a system.notification on applicationSuspend and the app is suspended by hitting the lock button or by letting it go to sleep, the notifications never fire. Am I missing something? They fire if I hit the Home button…

Edit:

The options of my notification only contain audio (i.e. no alert, no badge). From the home screen, the audio fires.

However, when I suspend the app via the LOCK button, these are the events in the console when the notification should fire:

SCHelper[1282] <Notice>: active (but IDLE) sessions

SCHelper[1282] <Notice>:   0x1e639890 {port = 0x1c03, caller = accountsd(89):com.apple.Accounts, path = /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist}

It appears that there is a difference in iOS between Idle and “Active but IDLE”

What I also found was that, if I send an an alert to my notification, then it will fire if the app has been LOCKED or has gone to sleep (i.e. Active, but IDLE). I do not want to send visual alerts – just audio. 

Any suggestions? Even if I could detect that the app was Active but IDLE on applicationSuspend, that would be helpful.

If I set a system.notification on applicationSuspend and the app is suspended by hitting the lock button or by letting it go to sleep, the notifications never fire. Am I missing something? They fire if I hit the Home button…

Edit:

The options of my notification only contain audio (i.e. no alert, no badge). From the home screen, the audio fires.

However, when I suspend the app via the LOCK button, these are the events in the console when the notification should fire:

It appears that there is a difference in iOS between Idle and “Active but IDLE”

What I also found was that, if I send an an alert to my notification, then it will fire if the app has been LOCKED or has gone to sleep (i.e. Active, but IDLE). I do not want to send visual alerts – just audio. 

Any suggestions? Even if I could detect that the app was Active but IDLE on applicationSuspend, that would be helpful.

Did you find a solution to this? I think im experiencing the same thing now. I dont either want so send visual alerts, only audio.

I submitted a bug, but I think they misunderstood:

My bug submission:

Bug title:
Audio only system.notifications do not fire if the app is Active, but IDLE

Bug description:
If I set an audio-only system.notification on applicationSuspend and the app is suspended by hitting the lock button or by letting it go to sleep, the notifications never fire. They fire if I hit the Home button… 

Steps to reproduce:
The options of my notification only contain audio (i.e. no alert, no badge). From the home screen, the audio fires.  However, when I suspend the app via the LOCK button, these are the events in the console when the notification should fire:

SCHelper[1282] : active (but IDLE) sessions SCHelper[1282] : 0x1e639890 {port = 0x1c03, caller = accountsd(89):com.apple.Accounts, path = /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist} 

 

It appears that there is a difference in iOS between Idle and “Active but IDLE”  What I also found was that, if I send an an alert to my notification, then it will fire if the app has been LOCKED or has gone to sleep (i.e. Active, but IDLE). I do not want to send visual alerts – just audio.  Any suggestions? Even if I could detect that the app was Active but IDLE on applicationSuspend, that would be helpful.

Corona’s reply:

When you suspend an app from the Home button, lock, or inactivity, the OS limits what you can do. My guess is scheduling a notification from the suspend event is not something that will work when the user locks the device (using the power power).

I can pass this along to Engineering but I think it’s a limitation imposed by Apple.

There is no way to determine how the app was suspended (Home, Lock, or inactivity). iOS sends out a suspension event which should be only used to save the state of your app. You must assume that the app may never resume (the user can kill the app or the OS can kill the app if it needs more memory).

I’m pretty sure they misunderstood – they talk about about how scheduling a notification won’t work if the device is locked; however, it DOES work if you have an alert message – just not if you only have audio. Audio only works when you suspend the app via the HOME button, but not when the device is locked or falls asleep.

I emailed a reply, but I’m not sure they got it – I’m not sure how to follow up:

Thanks for your reply. The weird thing is, notifications are properly scheduled as long as you set the visual alert – just not if you choose audio only. I also know of at least one other iOS app that will set audio notifications only – Meditation Timer:
https://itunes.apple.com/us/app/meditation-timer-free/id515571863?mt=8

In this app (free download), if you hit the home button, the lock button, let the app fall asleep, or even if the low battery warning (all cases of app suspension), audio only notifications fire. This is exactly the functionality I need for my app.

I have my fingers crossed, but I have little hope.

If I set a system.notification on applicationSuspend and the app is suspended by hitting the lock button or by letting it go to sleep, the notifications never fire. Am I missing something? They fire if I hit the Home button…

Edit:

The options of my notification only contain audio (i.e. no alert, no badge). From the home screen, the audio fires.

However, when I suspend the app via the LOCK button, these are the events in the console when the notification should fire:

It appears that there is a difference in iOS between Idle and “Active but IDLE”

What I also found was that, if I send an an alert to my notification, then it will fire if the app has been LOCKED or has gone to sleep (i.e. Active, but IDLE). I do not want to send visual alerts – just audio. 

Any suggestions? Even if I could detect that the app was Active but IDLE on applicationSuspend, that would be helpful.

Did you find a solution to this? I think im experiencing the same thing now. I dont either want so send visual alerts, only audio.

I submitted a bug, but I think they misunderstood:

My bug submission:

Bug title:
Audio only system.notifications do not fire if the app is Active, but IDLE

Bug description:
If I set an audio-only system.notification on applicationSuspend and the app is suspended by hitting the lock button or by letting it go to sleep, the notifications never fire. They fire if I hit the Home button… 

Steps to reproduce:
The options of my notification only contain audio (i.e. no alert, no badge). From the home screen, the audio fires.  However, when I suspend the app via the LOCK button, these are the events in the console when the notification should fire:

SCHelper[1282] : active (but IDLE) sessions SCHelper[1282] : 0x1e639890 {port = 0x1c03, caller = accountsd(89):com.apple.Accounts, path = /Library/Preferences/SystemConfiguration/com.apple.accounts.exists.plist} 

 

It appears that there is a difference in iOS between Idle and “Active but IDLE”  What I also found was that, if I send an an alert to my notification, then it will fire if the app has been LOCKED or has gone to sleep (i.e. Active, but IDLE). I do not want to send visual alerts – just audio.  Any suggestions? Even if I could detect that the app was Active but IDLE on applicationSuspend, that would be helpful.

Corona’s reply:

When you suspend an app from the Home button, lock, or inactivity, the OS limits what you can do. My guess is scheduling a notification from the suspend event is not something that will work when the user locks the device (using the power power).

I can pass this along to Engineering but I think it’s a limitation imposed by Apple.

There is no way to determine how the app was suspended (Home, Lock, or inactivity). iOS sends out a suspension event which should be only used to save the state of your app. You must assume that the app may never resume (the user can kill the app or the OS can kill the app if it needs more memory).

I’m pretty sure they misunderstood – they talk about about how scheduling a notification won’t work if the device is locked; however, it DOES work if you have an alert message – just not if you only have audio. Audio only works when you suspend the app via the HOME button, but not when the device is locked or falls asleep.

I emailed a reply, but I’m not sure they got it – I’m not sure how to follow up:

Thanks for your reply. The weird thing is, notifications are properly scheduled as long as you set the visual alert – just not if you choose audio only. I also know of at least one other iOS app that will set audio notifications only – Meditation Timer:
https://itunes.apple.com/us/app/meditation-timer-free/id515571863?mt=8

In this app (free download), if you hit the home button, the lock button, let the app fall asleep, or even if the low battery warning (all cases of app suspension), audio only notifications fire. This is exactly the functionality I need for my app.

I have my fingers crossed, but I have little hope.