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

  • Home
  • SEARCH
  • 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 8809419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:52:20+00:00 2026-06-14T02:52:20+00:00

I am developing an Android apps where user is able to find the phone

  • 0

I am developing an Android apps where user is able to find the phone once it is lost and I plan to implement the remote ringing function, I would like to do something like when the alarm is ringing, no matter the volume up or down key is pressed, the volume will still remain loudest while the alarm is ringing… But I have no idea how to achieve this… I just able to detect the event of volume keys pressed… Kindly need help for this.. Thanks…

@Override
public boolean onKeyDown(int keyCode, KeyEvent event){

    if (keyCode == KeyEvent.KEYCODE_VOLUME_UP){
        Toast.makeText(this, "Volume Up", Toast.LENGTH_LONG).show();
        return true;
    }

    if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN){
        Toast.makeText(this, "Volume Down", Toast.LENGTH_LONG).show();
        return true;
    }

    return super.onKeyDown(keyCode, event);
}
  • 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-14T02:52:21+00:00Added an answer on June 14, 2026 at 2:52 am

    Your code works fine for me. I threw it into a basic app, and it successfully intercepted the key presses without changing the volume on my device.

    Have you tried overriding onKeyUp as well as onKeyDown?

    EDIT: Note that this does not work in Services. You simply cannot intercept hardware volume button presses in services.

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

Sidebar

Related Questions

I am developing an android application with one basic function, to allow the user
I'm new developing android and web apps, I would like to know if is
I am developing apps for android smartphones. There is a social SDK to integrate
I'm developing mobile apps for iOS and Android. Mostly iOS. One of the clients
I am using Android SDK 1.6 and developing some simple apps. It seems everytime
I'm developing android application for CAR usage and I need that in phone or
I am developing android application, and I want to implement PHP as backend. I
I'm developing an Android Application that has three very similar Activities. I would like
i am developing android applicaiton disply user overlays on map.user values getting from webservices
Is it enough developing android apps without android device (without testing it on a

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.