- Home /
Does OnApplicationPause() guarantee to work?
I am scheduling the local notification in the OnApplicationPause function, on ios and android. Right now, every thing looks fine. But someone told me OnApplicationPause is not guaranteed to work. I am wondering in which cases, OnApplicationPause will NOT work so that I can safely avoid them.
Answer by Landern · Apr 27, 2017 at 03:08 PM
Nothing comes to mind, however, depending on the platform and depending on the actions taken by the user it's possible that you might think OnApplicationPause should be invoked but instead OnApplicationFocus is instead. Read up on the documentation and implement both to catch for either case.
https://docs.unity3d.com/2017.1/Documentation/ScriptReference/MonoBehaviour.OnApplicationFocus.html
https://docs.unity3d.com/2017.1/Documentation/ScriptReference/MonoBehaviour.OnApplicationPause.html
Your answer