1

我正在玩通知频道,并注意到模拟器的频道重要性级别不适合NotificationManager常量。

通知管理器:

public static final int IMPORTANCE_MIN = 1;
public static final int IMPORTANCE_LOW = 2;
public static final int IMPORTANCE_DEFAULT = 3;
public static final int IMPORTANCE_HIGH = 4;
public static final int IMPORTANCE_MAX = 5;

模拟器:

在此处输入图像描述

我通过以下方式检索了重要性级别:

NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        NotificationChannel channel2 = manager.getNotificationChannel(CHANNEL_2_ID);
        int importance = channel2.getImportance();

我错过了什么吗?

4

0 回答 0