androidaudiobluetoothspeakeraudio-source

What are the different (int routes) values for setAudioRoute (int routes)?


Where can I find a list for the different "int routes" available for the following functions :

setAudioRoute (int routes)

or

setRouting (int mode, int routes, int mask)

I would like to find a list with the different int like :

1 = speakers

2 = bluetooth

3 = headphones


Solution

  • You can find the possible audio routes in this documentation: CallAudioState

    I have found the best way to find this is using the documentation in the actual code. If you go inside the file look at the documentation for that function its:

       /**
         * Sets the audio route (speaker, bluetooth, etc...).  When this request is honored, there will
         * be change to the {@link #getCallAudioState()}.
         * <p>
         * Used by self-managed {@link ConnectionService}s which wish to change the audio route for a
         * self-managed {@link Connection} (see {@link PhoneAccount#CAPABILITY_SELF_MANAGED}.)
         * <p>
         * See also {@link InCallService#setAudioRoute(int)}.
         *
         * @param route The audio route to use (one of {@link CallAudioState#ROUTE_BLUETOOTH},
         *              {@link CallAudioState#ROUTE_EARPIECE}, {@link CallAudioState#ROUTE_SPEAKER}, or
         *              {@link CallAudioState#ROUTE_WIRED_HEADSET}).
         */
        public final void setAudioRoute(int route) {
            for (Listener l : mListeners) {
                l.onAudioRouteChanged(this, route, null);
            }
        }