1

I am not one to support jailbreaking but I've exhausted all other options in the regular SDK.

Is there a way to schedule a function to run every 2 minutes even while the app is in the background and the phone's screen is off? It would also need to re-initialize the app in the event the phone had killed it. This is similar to an android foreground service.

Leah Sapan
  • 3,621
  • 7
  • 33
  • 57

1 Answers1

-1

Have you tried running it on a background thread using grand central dispatch, you'll also have to set up a background enabled key in the plist file, Required Background modes key is not there in info-plist file.

Edit:

You could also set up a silent two minute song to be played in background and then call your function within -(void)audioPlayerDidFinishPlaying and repeat the song

Community
  • 1
  • 1
Conor Linehan
  • 448
  • 3
  • 11
  • That alone won't do it. Unless you take special action, your background run time is still limited, and your app will be suspended within a fairly short amount of time. – Nate Aug 04 '14 at 23:52
  • I think you have 30 seconds a thread so you could set up a counter that goes up by one each thread and fires your notification at the 4th thread – Conor Linehan Aug 05 '14 at 08:25
  • You could also set up a silent two minute song to be played in background and then call your function within -(void)audioPlayerDidFinishPlaying and repeat the song – Conor Linehan Aug 05 '14 at 12:15
  • I have no idea what your first comment means, but the second one (about silent audio) is useful. You should move that to your *answer*, because without it, what you have there is insufficient to solve the OP's problem (hence the down vote by someone ... not I). – Nate Aug 09 '14 at 00:07