Home > Blockchain >  How do games detect lost focus (such as opening notification pane) on Android
How do games detect lost focus (such as opening notification pane) on Android

Time:06-24

For example in game Asphalt 9, when the player swiping down the notification, the game is paused.

I have tried onPause, but it only fired when I switch to another app / activity. It doesn't detect something like opening the notification pane.

CodePudding user response:

You can override onWindowFocusChanged method of activity. It will loose focus when user open notification bar or some system dialog show up.

  • Related