Android notification buttons do not appear on the mobile device

0

I've always interacted with my Android application through the emulator, but recently I started testing everything I did with my phone.

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

Can anyone tell me why this happens?

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);
    
asked by anonymous 27.09.2017 / 15:49

0 answers