Skip to content

Conversation

@gibertoni
Copy link
Contributor

When the game is active but there is another application on foreground
If the device is locked or sleeps
Then the application that was running on foreground will be dismissed and trigger a onWindowsFocusChanged(true) event while the game is already on background

Steps to reproduce:

  • Open the game and check that background music is playing
  • Open another application that takes focus (e.g. Facebook Messenger's chat heads)
  • Lock the device
  • Verify that the music pauses (since it enters onPause), but then the music resumes (since onWindowsFocusChanged is called)

If the device is locked or sleeps
Then the application that was running on foreground will be dismissed and trigger a onWindowsFocusChanged(true) event while the game is already on background
@gibertoni gibertoni changed the title The background music resumes even though the application is on the background [Android] The background music resumes even though the application is on the background Aug 28, 2018
@drelaptop drelaptop self-requested a review August 31, 2018 01:12
@drelaptop drelaptop added this to the 3.18 milestone Aug 31, 2018
Copy link
Contributor

@drelaptop drelaptop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to reproduce, but this patch looks good, and make the resumeIfHasFocus more safely.

@drelaptop drelaptop merged commit 6fb631e into cocos2d:v3 Sep 10, 2018
j-jorge pushed a commit to iscoolent/cocos2d-x that referenced this pull request Apr 9, 2019
…e background (cocos2d#19005)

If the device is locked or sleeps
Then the application that was running on foreground will be dismissed and trigger a onWindowsFocusChanged(true) event while the game is already on background
huangwei1024 pushed a commit to huangwei1024/cocos2d-x that referenced this pull request Jun 20, 2019
…e background (cocos2d#19005)

If the device is locked or sleeps
Then the application that was running on foreground will be dismissed and trigger a onWindowsFocusChanged(true) event while the game is already on background
fbrescia pushed a commit to iscoolent/cocos2d-x that referenced this pull request Jul 3, 2020
…e background (cocos2d#19005)

If the device is locked or sleeps
Then the application that was running on foreground will be dismissed and trigger a onWindowsFocusChanged(true) event while the game is already on background
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants