How to open the built in Equalizer programmatically in Android?
The following should work to start the default equalizer Activity
:
Intent intent = new Intent(AudioEffect
.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
if ((intent.resolveActivity(getPackageManager()) != null)) {
startActivityForResult(intent, REQUEST_EQ);
} else {
// No equalizer found :(
}
Spotify does the same basically, haven't checked the others.
The necessity of startActivityForResult()
is explained in the docs:
The intent carries a number of extras used by the player application to communicate necessary pieces of information to the control panel application.
The calling application must use the
android.app.Activity#startActivityForResult(Intent, int)
method to launch the control panel so that its package name is indicated and used by the control panel application to keep track of changes for this particular application.