How do I execute code with closed or minimized application?

Asked

Viewed 85 times

0

I want to run code that keeps the screen always lit, it already works perfectly when I am inside the APP, however, if I minimize or close it, stop working.

OBS: I am using Uikit.framework

code that keeps the screen lit:

[[UIApplication sharedApplication] setIdleTimerDisabled: YES];

How I could follow with it active even closing or minimizing the app?

I found this project on the internet:

https://github.com/muhku/FreeStreamer/tree/master/FreeStreamerMobile

It is a radio APP, when I play the radio and minimize the APP, it keeps playing. I want something like this, only instead of a Radio Streaming, I want to run the code shown above.

  • 1

    Have you tried putting this code in the method applicationDidBecomeActive:(Uiapplication *)application from your Appdelegate? This will force every time the app comes back, set the waiting time to disabled.

  • Thank you Lucas, I’ll try this way and I’ll see you tomorrow if I made it or not :)

  • @Lucaseduardo , as deactivating the waiting time?

  • I posted an example in the question. In this example when I minimize the application, it keeps working.

1 answer

1


There is no app running in the background on iOS other than some exceptions (music, gps, bluetooth, etc).

See the official documentation for more information: iOS - Background Execution

Browser other questions tagged

You are not signed in. Login or sign up in order to post.