4

My app is not starting from current state, without closing my app i am going to push into background. I am just minimizing my app but not closing my app. If again start my app its going to start from starting like from splash screen.

I want start my app from current state where i have minimize my app.

My question is:

What i need to do in app delegate class, here i my work around:

-(void) applicationDidEnterBackground:(UIApplication*)application {
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"SplashLoadCheck"];
    [[NSUserDefaults standardUserDefaults]synchronize];     
    if( [navController_ visibleViewController] == director_ )       
         [director_ stopAnimation]; 
}

-(void) applicationWillEnterForeground:(UIApplication*)application 
{   
     if( [navController_ visibleViewController] == director_ )      
        [director_ startAnimation]; 
}

- (void)applicationWillTerminate:(UIApplication *)application {

    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"SplashLoadCheck"];
    [[NSUserDefaults standardUserDefaults]synchronize];     CC_DIRECTOR_END(); 
}
NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
Boosa Ramesh
  • 379
  • 3
  • 19

2 Answers2

1

You can set your following plist flag.

"Application Does Not Run in Background" = NO.

This will allow the application to run in background as well.

NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
0

In order to run your app in the background, you should enable the required background modes of your app. This is depends on the kind of app you have. Otherwise apple will reject the app. One more thing even though you are not turning on the background modes, app will not terminate immediately. OS will put your app in an idle state and terminate automatically when it requires. Until this termination happens, if you are launching the app again app will come to the same state where you left it before going to background.

Here is the list available background modes

enter image description here

Community
  • 1
  • 1
Anil Varghese
  • 42,757
  • 9
  • 93
  • 110