Is there any way to check if iOS app is in background?

bobby grenier picture bobby grenier · Apr 29, 2011 · Viewed 87.9k times · Source

I want to check if the app is running in the background.

In:

locationManagerDidUpdateLocation {
    if(app is runing in background){
        do this
    }
}

Answer

DavidN picture DavidN · Apr 29, 2011

App delegate gets callbacks indicating state transitions. You can track it based on that.

Also the applicationState property in UIApplication returns the current state.

[[UIApplication sharedApplication] applicationState]