Basically I want to trigger an event when my is lost focus, something like in asphalt game. Even when you swipe down notification, the game immediately paused.
in android it’s called onWindowFocusChanged;
Basically I want to trigger an event when my is lost focus, something like in asphalt game. Even when you swipe down notification, the game immediately paused.
in android it’s called onWindowFocusChanged;
it works only on IOS. On Android, it only fire onpause and onresume event. I would like it to onwindowfocuschanged.
Why is this matter ? because on Android, you can still using chat apps on notification area, also there is case about floating window. Both of them doesn’t fire onpause event on android.
visibilitychange worked for us. Document: visibilitychange event - Web APIs | MDN
You could try using the App Capacitor Plugin to check for pause and resume states.
I don’t know the limitations but it’s a good place to start.
Unfortunately it only fire onpause on android. The onpause event doesn’t get fired when user open notification or switch apps using multi window.