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 9173989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:40:42+00:00 2026-06-17T16:40:42+00:00

I am using AudioTrack to play the sound I recieve through UDP sockets. I

  • 0

I am using AudioTrack to play the sound I recieve through UDP sockets. I am getting a lot of noise along with the sound so I decided to use AudioManager. But AudioManager changes sound routing beyond the bounds of the application. Below is the code I am using.

        m_amAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); 
        m_amAudioManager.setMode(AudioManager.MODE_IN_CALL); 
        m_amAudioManager.setSpeakerphoneOn(false); 

The problem with this code is that when I close the app and start a Music Player, the sound comes from the front speaker and not the ususal back speaker and I cannot change it somehow.
To resolve this issue I decided to add the following line when I am closing my app.

 m_amAudioManager.setSpeakerphoneOn(true);

But with this line the problem is that when I recieve a call (normal call), by default the speaker is turned on. I really need help on this please.

  • 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-17T16:40:43+00:00Added an answer on June 17, 2026 at 4:40 pm

    First you will need to declare the User permission MODIFY_AUDIO_SETTINGS in you manifest to change the AudioManager settings.

    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    
    1. Before you change any settings, you must save the current AudioManager settings!

      oldAudioMode = audioManager.getMode();
      oldRingerMode = audioManager.getRingerMode();
      isSpeakerPhoneOn = audioManager.isSpeakerphoneOn();
      
    2. Apply your Audio settings (Example)

      audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
      audioManager.setMode(AudioManager.MODE_NORMAL);
      audioManager.setSpeakerphoneOn(true);
      
    3. Then on finish, restore the settings

      audioManager.setSpeakerphoneOn(isSpeakerPhoneOn);
      audioManager.setMode(oldAudioMode);
      audioManager.setRingerMode(oldRingerMode);
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to play audio buffered sound (.wav) using AudioTrack. Please see the
I'm using AudioTrack to play a PCM WAV sound file on Android (see also
Currently I'm using AudioTrack passing to it audio data from native layer to play.
I have managed to play audio files using ffmpeg and AudioTrack class in my
Decoded audio using FFmpeg (function avcodec_decode_audio3) and try to reproduce it through Audiotrack in
I m trying to capture the played file in MediaPlayer using Visualizer and play
Is it possible to use the FLVPlayback class to play an instance of the
Using Sinatra and DataMapper. This is my first time trying to use more than
I am using Audio track to play a different sounds, in stream mode. I
I want to play back WAV sound (audio track of some custom video format)

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.