Autore Topic: Notification API level 24  (Letto 96 volte)

Offline oem2003

  • Nuovo arrivato
  • *
  • Post: 2
  • Respect: 0
    • Mostra profilo
Notification API level 24
« il: 08 Novembre 2017, 13:51:20 CET »
0
Buongiorno,
ho un problema cercando di impostare una icona al bottone  mute su android nougat 7.0 non si vede l'immagine ecco il codice in uso


PendingIntent contentIntent = PendingIntent.getService(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
        Resources res = this.getResources();

        NotificationCompat.Builder builder = new NotificationCompat.Builder(this) ;
        builder
                .setStyle(new NotificationCompat.BigTextStyle())
                .setContentTitle(res.getString(R.string.app_name))
                .setContentText("")
                .setSmallIcon(R.drawable.ic_call_black_24dp)
                .setTicker("")
                .setAutoCancel(true)
                .setWhen(System.currentTimeMillis())
                .setContentIntent(contentIntent)
                .addAction(new NotificationCompat.Action(R.drawable.ic_arrow_drop_down_circle_black_24dp,"mute",contentIntent));

        Notification notification= builder.build();
        NotificationManagerCompat.from(this).notify(0,notification);
      //  NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
       // noti.flags |= Notification.FLAG_AUTO_CANCEL;
       // notificationManager.notify(0, noti);
    }
Grazie in anticipo