Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda