Single-channel Bluetooth for music playback

Source: Internet
Author: User

I bought a single-channel Bluetooth headset. I didn't expect to have to make a phone call, but I couldn't listen to music. But when I call the phone and play the music again, the sound will come out of the Bluetooth headset. Can I write a location that controls the audio output? After searching online, there are two pieces of software that can be used: Super mono free trial and supermonofroyofreetrial. They are free of charge, but they are restricted in use. In a rage, they are cracked, the implementation code is as follows:

 

Output to Bluetooth headset:

 

Audiomanager mam = (audiomanager) getsystemservice (context. audio_service );

Mam. setmode (audiomanager. mode_in_call );

Mam. setincluthscoon (true );

Mam. startbluw.thsco ();

 

Output to mobile phone:

Audiomanager mam = (audiomanager) getsystemservice (context. audio_service );

Mam. setmode (audiomanager. mode_normal );

Mam. setincluthscoon (false );

Mam. stop1_thsco ();

 

Add capabilities in androidmanifest. xml:

<Uses-Permission Android: Name = "android. Permission. modify_audio_settings"/>

 

Several lines of code. The output to a Bluetooth headset may be delayed.

Set the volume to the Control Source

Setvolumecontrolstream (audiomanager. stream_music );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.