Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Listening to volume button events android

I saw this topic

Listen to volume buttons in background service?

and know the way to listenting to volume keys in background service is to detect the amount of system volume(or music...) and see if it decrease or increase we can detect buttons

i see an app that detects pressing volume up/down button together in locked mode or screen off and it is using AccessibilityService. how it is possible?

https://play.google.com/store/apps/details?id=in.blogspot.anselmbros.torchie&hl=en

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can create BroadcastReceiver inside Service.

public class MyService extends Service {

    @Override
    public void onCreate() {
        super.onCreate();
        final BroadcastReceiver vReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                 //your code here
            }
        };
        registerReceiver(vReceiver, new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));
    }
}

Or playing media with 0 volume in background and then the key will be always listened by Reciever with MediaButtonIntent as shown in this GitHub sample

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!