Closing and then reopening app iOS

Hi,

I am trying to make a command run right when a user returns from my app when it has been closed / suspended.

I have found the function OnApplicationPause in the Unity docs, but this does not seem to work for me.

function OnApplicationPause (pauseState : boolean) {

     CameraDevice.Instance.SetFlashTorchMode(true);
}

I am having trouble finding information about this on the forum too. Has anyone made a return from suspension menu or something that can point me in the right direction?

Maybe look at the code on AppController.mm. iOS sends to this code messages to tell it what’s happening. There is an applicationDidResignActive and applicationDidBecomeActive. The code inside applicationDidBecomeActive suggests that a call is made into UnityPause(). Internally that does call into OnApplicationPause. So check that you get the callback and "-> applicationDidBecomeActive()
" gets printed.

Fantastic, that worked!
Thank you so much!

I just added a UnitySendMessage command to my AppController.mm file in my Xcode build:
// For iOS 4
// Callback order:
// applicationWillEnterForeground()
// applicationDidBecomeActive()
- (void)applicationWillEnterForeground:(UIApplication *)application
{
UnitySendMessage(“Button”, “BackFromApp”, “”);
printf_console("-> applicationWillEnterForeground()
");
}

This is great indeed,

With Regards,
Protar.
Plex App
Tutuapp App
Vidmate App