Hi, Can I use a timer in suspension mode at the build 971 ? when I suspension the app the timer stoped. [import]uid: 201130 topic_id: 34690 reply_id: 334690[/import]
Hi @Hong,
I would suggest the “safest” method is to read the time remaining (on the timer) when you suspend, save it to a file (text, JSON, etc.), and cancel the timer. Then on resume, read the value from the file and start a new timer with that duration.
Brent [import]uid: 200026 topic_id: 34690 reply_id: 137830[/import]
Hi Brent Sorrentino, thank you for your prompt reply. it is possible to run the timer when the app suspended. I need the get http request at a suspend mode in assign time. [import]uid: 201130 topic_id: 34690 reply_id: 137845[/import]
I think you are referring to your app going into a background mode and trying to process actions while suspended.
Apple only permits this under certain circumstances. Those are listed here:
In general you add a key to your build.settings plist = {} block:
UIBackgroundModes = {
"audio"
},
But since we don’t know what you’re trying to do and these allowed purposes are very specific so if you try to use one of these modes and your app really doesn’t do what it supposed to, like use newsstand when you’re not really a newsstand app, there is a very good chance that Apple will reject it.
Also, I don’t know how to do any of this with Android.
[import]uid: 199310 topic_id: 34690 reply_id: 137971[/import]
Hi @Hong,
I would suggest the “safest” method is to read the time remaining (on the timer) when you suspend, save it to a file (text, JSON, etc.), and cancel the timer. Then on resume, read the value from the file and start a new timer with that duration.
Brent [import]uid: 200026 topic_id: 34690 reply_id: 137830[/import]
Hi Brent Sorrentino, thank you for your prompt reply. it is possible to run the timer when the app suspended. I need the get http request at a suspend mode in assign time. [import]uid: 201130 topic_id: 34690 reply_id: 137845[/import]
I think you are referring to your app going into a background mode and trying to process actions while suspended.
Apple only permits this under certain circumstances. Those are listed here:
In general you add a key to your build.settings plist = {} block:
UIBackgroundModes = {
"audio"
},
But since we don’t know what you’re trying to do and these allowed purposes are very specific so if you try to use one of these modes and your app really doesn’t do what it supposed to, like use newsstand when you’re not really a newsstand app, there is a very good chance that Apple will reject it.
Also, I don’t know how to do any of this with Android.
[import]uid: 199310 topic_id: 34690 reply_id: 137971[/import]
hi, all, I’m not having any luck making a timer keep firing in the background on applicationSuspend. It seems indeed that timers are just automatically cancelled. Since the goal of my app is to fire notifications on a preset schedule, I turned then to using local notifications fired on intervals. I find the performance on my oldish iPhone 4 a bit hard to predict. If you close the app, the notification will fire on the interval specified by the user in a settings screen I have built a maximum of twice. If the notification goes ‘unanswered’ e.g. unclicked, the process just stops. I don’t see any way around this. Pretty frustrating.
My workaround was to reset the notification if the app is reopened (applicationStart or applicationResume).
How do you set local notifications to fire on a schedule over a day? Can you guarantee that the notification will continue to fire in the background if unanswered?
Any strategies for Android, while I’m at it? I don’t think this stuff works at all on Android.
thanks very much,
best,
Jen [import]uid: 81642 topic_id: 34690 reply_id: 141377[/import]
hi, all, I’m not having any luck making a timer keep firing in the background on applicationSuspend. It seems indeed that timers are just automatically cancelled. Since the goal of my app is to fire notifications on a preset schedule, I turned then to using local notifications fired on intervals. I find the performance on my oldish iPhone 4 a bit hard to predict. If you close the app, the notification will fire on the interval specified by the user in a settings screen I have built a maximum of twice. If the notification goes ‘unanswered’ e.g. unclicked, the process just stops. I don’t see any way around this. Pretty frustrating.
My workaround was to reset the notification if the app is reopened (applicationStart or applicationResume).
How do you set local notifications to fire on a schedule over a day? Can you guarantee that the notification will continue to fire in the background if unanswered?
Any strategies for Android, while I’m at it? I don’t think this stuff works at all on Android.
thanks very much,
best,
Jen [import]uid: 81642 topic_id: 34690 reply_id: 141377[/import]