Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8517581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:44:32+00:00 2026-06-11T05:44:32+00:00

From my android application I want to stream audio to any available speaker like

  • 0

From my android application I want to stream audio to any available speaker like A2DP speaker ,docking speakers or car speaker.

for doing this I want to use Bluetooth connection and stream over Bluetooth connection…

I saw following links

On android how to reroute audio from a2dp

setBluetoothA2dpOn (boolean on)

Android 2.3: How do I switch from SCO to A2DP for a capable Bluetooth speaker?

But everywhere I found the same .. i.e.

public void setBluetoothA2dpOn (boolean on)

This method is deprecated.
Do not use. 

Please guide me on how to do this..Or suggest if it can be done using some other way..
Any help/suggestion is appreciated.

EDIT :

PERMISSION in manifest :

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

CODE :

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    layout = (RelativeLayout) findViewById(R.id.layout);
    text = (TextView) findViewById(R.id.editText1);
    scoSwitch = (ToggleButton) findViewById(R.id.switch1);
    try {
        mp1 = MediaPlayer.create(this, R.raw.jc_cm);
        mp2 = MediaPlayer.create(this, R.raw.rp);
        amanager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        //amanager.setBluetoothA2dpOn(true);
                } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

public void onSCOswitch(View view){
    if (scoSwitch.isChecked()){
        amanager.setBluetoothScoOn(true);
        amanager.startBluetoothSco();
        Log.d("Bluetooth", "SCO on");
        amanager.setMode(AudioManager.MODE_IN_COMMUNICATION);
    }
    else{
        amanager.stopBluetoothSco();
        amanager.setBluetoothScoOn(false);
        amanager.setBluetoothA2dpOn(true);
        Log.d("Bluetooth", "SCO off");
        amanager.setMode(AudioManager.MODE_NORMAL);
    }
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:44:34+00:00Added an answer on June 11, 2026 at 5:44 am

    i refer u this link please try this

    Android: Playing sound over Sco Bluetooth headset

    TTS output always going to A2DP

    i thing this link can help u

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to connect to Picasa from an Android application (without interacting with any
I want to create an Android application that show the sales report from SQL
I want to retrieve values from SQLite database in my Android application. Here in
I want to get some text from a PHP page into an Android application.
I want to download files from internet in my Android Native application. I was
What I would like to accomplish from my Android application is an ability to
Possible Duplicate: Android Launch an application from another application I want to start Another
I want to Reading Color from Android Application. Here I have developed one Application,
I have an Android application from which I want to upload some data to
Hi: I want to implement a http remote control for an Android application: From

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.