When I start my Project game(using SimpleAudioEngine / cocos 3.16_ver / android Build / android Studio 3.0), than other music applications stop(ex. Samsung Music). I want when i playing the game, listen My Music(not Game Background Music).
i did not modify android source.
How do I fix this?
This is a bug in 3.16 version.
You should modify code in Cocos2dxActivity.java (cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java
)
@Override
protected void onResume() {
Log.d(TAG, "onResume()");
super.onResume();
// issue #18465
AudioManager manager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
if (!manager.isMusicActive()) {
Cocos2dxAudioFocusManager.registerAudioFocusListener(this);
}
this.hideVirtualButton();
resumeIfHasFocus();
Cocos2dxEngineDataManager.resume();
}
https://github.com/cocos2d/cocos2d-x/issues/18465#issuecomment-344135839