MonoBehaviour.OnApplicationQuit() can not be called on Android or iOS devices

Hello,

I found that The OnApplicationQuit() cannot be called when the app is closed by Android/iOS.(it’s good on unity editor)
Then cause to my “player.stop” event can not be sent when user close the app. (player.stop trigger in OnApplicationQuit()).

There are the same issues online, but no suitable solution.
The most solution is that replace OnApplicationQuit() by OnApplicationPause(), but it is not fit for the player.stop event.

I also found a note in OnApplicationQuit() introduction,
“Note that iOS applications are usually suspended and do not quit. You should tick “Exit on Suspend” in Player settings for iOS builds to cause the game to quit and not suspend, otherwise you may not see this call. If “Exit on Suspend” is not ticked then you will see calls to OnApplicationPause instead.”

But the “Exit on Suspend” has Obsoleted.

Is there a way can guaranteed OnApplicationQuit() be called when closing, or there is any other solution?

Thank you very much!!
Song

I have the same problem, any idea to solution//???

This answer has a good answer to your question:

bottom line, whatever you need to do, make it work using OnApplicationPause