Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

165
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda