6

on all Huawei, Honor, Xiaomi with Android Marshmallow (custom ROM for dual SIM), the notification small icon setSmallIcon is always set to the default app activity icon, I have not been able to put my own as it should. The large icon setLargeIcon is working fine. Tested API 21 and 23. Has anyone a working code?

test(R.drawable.ic_mynotificon, "Test");

private void test(int resID, String txt)
{
    final NotificationManagerCompat mNotificationManager = NotificationManagerCompat.from(getContext());
    final NotificationCompat.Builder notif_builer = new NotificationCompat.Builder(getContext())
        .setContentTitle(txt)
        .setContentText(txt)
        .setSmallIcon(resID)
        .setDefaults(NotificationCompat.DEFAULT_ALL);

    mNotificationManager.notify(999, notif_builer.build());
    return;
}
wire67
  • 81
  • 7

0 Answers0