Android notification buttons do not appear on mobile device

Asked

Viewed 64 times

0

I always interacted with my Android application by emulator, but recently I started to test everything I did with my phone.

I created some notifications with buttons, and in the emulator they appear as expected and do what they are supposed to do, but on my phone, only the notification appears the buttons do not exist.

Can anyone tell me why this is happening?

I leave here part of the code where I create the buttons in the notification.

Intent intentCriado = new Intent(context, CriadoService.class);
intentCriado.putExtra("id", id);
intentCriado.putExtra("idTrabalho", idTrab);

PendingIntent resultPendingTrablalhoCriado =
        PendingIntent.getService(context,
                0,
                intentCriado,
                PendingIntent.FLAG_CANCEL_CURRENT
        );

Intent intentCancelado = new Intent(context, CanceladoService.class);
intentCancelado.putExtra("id", String.valueOf(id));
intentCancelado.putExtra("idTrabalho", String.valueOf(idTrab));

PendingIntent resultPendingTrablalhoCancelado =
        PendingIntent.getService(context,
                0,
                intentCancelado,
                PendingIntent.FLAG_CANCEL_CURRENT
        );

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
        .setContentTitle("TRABALHOS:")
        .setContentText(mensagem)
        .setContentIntent(resultPendingTrablalhoCriado)
        .setAutoCancel(true);
mBuilder.setSmallIcon(R.drawable.icon);
mBuilder.addAction(R.drawable.icon, "Sim", resultPendingTrablalhoCriado);
mBuilder.addAction(R.drawable.icon, "Não", resultPendingTrablalhoCancelado);
mBuilder.setPriority(Notification.PRIORITY_MAX);
  • What versions of Android emulator and phone?

  • Emulator 7.1.1 @ramaral phone 5.1.1

  • If in fact the version of the phone is 5.1.1 I see no reason for this to happen, unless the notification needs to be expanded manually.

  • I tested with an emulator that has the same version as my phone 5.1.1, and actually the notification buttons do not appear, but in emulator with version 7.1.1 appear.... @ramaral

  • Make sure you can expand the notification with your fingers.

  • I slide my finger down and a very distorted image appears and notice that the two buttons are there, but they are not clear... @ramaral

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.