October 15, 2019 at 11:42 am #1748
Here’s my problem.
When the purchase starts, OnApplicationPause(true) is called. But when the purchase ends, completed or not, OnApplicationPause(false) is never called.
It’s happen sometimes when I press the overview button. OnApplicationPause(true) is called when pressed, but OnApplicationPause(false) isnt’ always called when I reoppend the app.
This is very critical for me, because Unity updates and callback aren’t called when it’s paused.
Thanks for your help.October 15, 2019 at 6:31 pm #1753
What is “OnApplicationPause”? Is it some Unity API?October 15, 2019 at 7:05 pm #1755
Yes, it’s called automatically when the app is paused/unpaused, by the OS for instance.
Here’s more : Unity3D OnApplicationPause documentationOctober 16, 2019 at 7:21 pm #1762
Frankly, I can’t say much without detailed look at the code. Maybe some browser lifecycle method might help you with it? E.g. when URL starts or finished loading.October 17, 2019 at 10:06 am #1763
I understrand this will be a tricky one.
So when my app resume after the purchase (but still on pause == true), I can’t do anything except naviguate the web trough the browser.
The only solution I found is to close the browser, and only then, OnApplicationPause(false) is sent by Unity. But I Have to do it manualy, because I can’t detect any event to do it automaticly. Not very user friendly.October 21, 2019 at 5:20 pm #1789
Here some more details where you can see some logs. (blurred part are useless and/or confidential)
It happen too when i’m sharing something with the native android API.
In other words, when somthing shows up top of my app, Unity’s pause is called, but when I go back to my app, if the in app browser is still open, the end of the pause is never detected by unity.
By the way, when the browser is running, Unity considers the focus always lost for the app. Not a problem for me, but could be for others.
Thank youOctober 21, 2019 at 7:10 pm #1792
It should be fairly easy to add callbacks like “application become active” / “application become paused” while browser was open, would that be helpful for you?October 22, 2019 at 12:52 pm #1799
It won’t work, because Unity don’t get any callbacks while it’s paused.
I found a poor but working solution.
I close the in app browser just before an in app purchase or a share action that put the application on pause. When the purchase or the share is done, I reopen the browser at the last url.
But this solution doesn’t work with the pause started with the home or overview buttons. The applications crashes in these cases.
- You must be logged in to reply to this topic.