较旧的API级别的通知缺少应用名称

时间:2018-08-18 21:25:35

标签: android notifications material-design legacy android-api-levels

为什么通知中缺少应用名称?

这是通知在具有API级别16的AVD上的外观:

enter image description here

这里是API级别28(隐藏的应用名称):

enter image description here

代码:

   mBuilder = new NotificationCompat.Builder(mContext, Constants.CHANNEL_ID_TRANSFER_PROGRESS)
            .setSmallIcon(R.drawable.icon_import_export)
            .setContentText("Import successful")
            .setPriority(NotificationCompat.PRIORITY_LOW)
            .setCategory(NotificationCompat.CATEGORY_SERVICE)
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
    mNotificationManager = NotificationManagerCompat.from(mContext);
    mNotificationManager.notify(Constants.NOTIFICATION_ID_TRANSFER_PROGRESS, mBuilder.build());

0 个答案:

没有答案