Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open the built in Equalizer programmatically in Android?

I have seen many apps opening systems in built Equalizer (google play music, Spotify, Samsung stock music player). Directly, without having to write their own from scratch. How do these apps do that? I couldn't find a solution.

} else if (id == R.id.action_fx) {
        Intent intent = new Intent();
        intent.setAction("android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL");
        if ((intent.resolveActivity(getPackageManager()) != null)) {
            startActivity(intent);
        } else {
            Intent intent11 = new Intent(MainActivity.this, Help.class);
            intent11.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(intent11);
            // No equalizer found :(
        }
        return true;
like image 329
abbie Avatar asked Jun 12 '16 13:06

abbie


People also ask

Does Android have built in EQ?

Many Android OEMs have EQs in the sound section of the settings. Some devices do it better than others, but about half of them let you adjust device-wide audio through an EQ. Usually it's something close to a 10-band EQ along with some added stuff like Dolby Atmos or EQ presets.

Where is my equalizer on my phone?

On an Android phone, you will find the equalizer setting hidden in the Sound & Vibration section of the Settings app, though the exact menu location may vary depending on your device's manufacturer.


1 Answers

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.

like image 174
earthw0rmjim Avatar answered Oct 06 '22 10:10

earthw0rmjim