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

179
Visualizações
Android : how to NOT bring the app to front when the user clicks on a button in the notification?

I have got a notification with buttons on it and these buttons modify the notification interface when the user clicks on one of them.

The notification interface updates properly but...the main activity of my app is also brought to front.

How to avoid bringing the app to front?

Thanks !!!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Found the solution !

The intent of the notification has to fire a service and not an activity.

Intent buttonsIntent = new Intent(this, NotificationManagementService.class);
        buttonsIntent.putExtra("do_action", action);
        contentView.setOnClickPendingIntent(R.id.notifButton, PendingIntent.getActivity(this, 0, buttonsIntent, PendingIntent.FLAG_UPDATE_CURRENT));
        notification.contentView = contentView;
  mNotificationManager.notify(1, notification);
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