0

Bonjour J'ai mis en place des notifications Push dans mon application. Cela fonctionne bien et affiche l'icône de notification correctement pour les périphériques ci-dessous la version nougat. Mais, il affiche l'icône de notification comme carré avec la couleur blanche.Affichage de l'icône de notification comme Square dans Nougat

Ci-dessous mon code:

Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 
      NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) 
        .setSmallIcon(R.mipmap.app_icon) 
        .setColor(ContextCompat.getColor(getApplicationContext(),R.color.white)) 
        .setContentTitle(strTitle) 
        .setContentText(messageBody) 
        .setAutoCancel(true) 
        .setSound(defaultSoundUri) 
        .setContentIntent(pendingIntent); 

      NotificationManager notificationManager = 
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 

      notificationManager.notify(++NOTIFICATION_ID /* ID of notification */, notificationBuilder.build()); 

Répondre

0

Tout d'abord, ce n'est pas une erreur. Il s'agit d'un changement dans la conception avec Android Nougat

Pour Android Nougat, vous devez fournir une icône arrondie pour la notification. Consultez le lien this et le this pour plus de détails.