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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:21:49+00:00 2026-06-04T21:21:49+00:00

How can I make as long as the app is opened, the users shouldn’t

  • 0

How can I make as long as the app is opened, the users shouldn’t be allowed to change the volume of the device?, if this is possible.

I have found that you can set the volume to mute with AudioManger:

AudioManager volumeControl = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
volumeControl.setStreamMute(AudioManager.STREAM_MUSIC, true);

However this is not what I’m looking for. I want when the user enters the application to lock its current volume and does not allow to change it, while in background a melody is playing increasing the volume. (this is the reasons for why I don’t want let user control the volume)

I was thinking if there’s a possibility to override the Volume up, Volume down keys? just like we can override the Back button.

  • 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-04T21:21:50+00:00Added an answer on June 4, 2026 at 9:21 pm

    I was thinking if there’s a possibility to override the Volume up, Volume down keys? just like we can override the Back button.

    Yes, you can handle it in the same way.

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)){
            //Nothing
        }
        return true;
    }
    

    @sarnold I can see the use case if it is an alarm clock. Many people want this feature in alarm clocks to stop themselves from turning the sound off when they are wanting to wake up.

    Either way, be aware that you may annoy your users doing things like this. It should be avoided if at all possible.

    EDIT: Setting the Volume

        AudioManager am =  (AudioManager) getSystemService(AUDIO_SERVICE); 
        am.setStreamVolume(AudioManager.STREAM_MUSIC,6,0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building this app and I can't make it work. Here is the
Short story: I can't make precompiled headers work properly with gcc -c option. Long
I can make batch or vbs file on windows and run. this can automate
Can someone tell me how I can make the following output? I have a
How i can make modifications to code after i deployed it on iPhone device.
when I opened the app, let it run in background mode for long time,
Im trying to make an app that converts distance/area/volume using spinners as a unit
This question can have different answers because everyone would do it his own way.
I have a google app engine project and i want to make my REST
I will try to make this as clear as I can. Please let me

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.