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?
– ramaral
Emulator 7.1.1 @ramaral phone 5.1.1
– Nokas
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.
– ramaral
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
– Nokas
Make sure you can expand the notification with your fingers.
– ramaral
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
– Nokas