For my project, we have an analytics call that we want to perform when the user is trying to close the application. When we test the logic in the editor, it works just fine. However, on device the code does not get called. I have seen from some other posts that quitting/destroying logic for the application/monobehaviours does not work properly.
Is there a resolution or other way to trigger application quitting logic for a Unity application on Oculus devices?
This is an ungoing saga. https://forum.unity.com/threads/onapplicationquit-and-ondestroy-is-not-executed-when-exit-app-on-ocu...
The 'easy' not totally reliable way to do this is to hook into OnApplicationPause but as the above explains, this isn't exactly the same as an application suspend event.
I find you also have to use the various Oculus specific events in the application lifecycle:
to work out whether the app has quit or if some other esoteric thing has happened like the player moving out of their Guardian