Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何检测我是否有';t为我发布的通知创建了NotificationChannel,日志除外?_Android_Notifications_Android 8.0 Oreo - Fatal编程技术网

Android 如何检测我是否有';t为我发布的通知创建了NotificationChannel,日志除外?

Android 如何检测我是否有';t为我发布的通知创建了NotificationChannel,日志除外?,android,notifications,android-8.0-oreo,Android,Notifications,Android 8.0 Oreo,我正在Android上构建一个通知基础设施,一旦我创建了一个NotificationChannel,当我的应用程序通过编译、安装和强制停止一次又一次地被终止和重新启动时,该频道似乎仍然存在 通知频道什么时候消亡?仅在设备重新启动时 我在我的代码中创建了如下通道: private void createNotificationChannel() { // Create the NotificationChannel, but only on API 26+ because

我正在Android上构建一个通知基础设施,一旦我创建了一个NotificationChannel,当我的应用程序通过编译、安装和强制停止一次又一次地被终止和重新启动时,该频道似乎仍然存在

通知频道什么时候消亡?仅在设备重新启动时

我在我的代码中创建了如下通道:

private void createNotificationChannel() {
        // Create the NotificationChannel, but only on API 26+ because
        // the NotificationChannel class is new and not in the support library
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
            return;
        NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
        channel.setDescription(NOTIFICATION_CHANNEL_DESCRIPTION);
        mNotificationManager.createNotificationChannel(channel); // Register the channel with the system; you can't change the importance or other notification behaviors after this
    }
mNotificationManager.getNotificationChannel("NotificationChannelId") != null
…频道仍然存在我的问题是,在我重新编译并重新安装之后,通道仍然存在,并且我无法为我的客户端开发人员引发运行时异常,因为我无法正确检测未创建通道的时间。 我已经确保我的apk已经构建并安装了所有的更改(所说的更改并没有创建通道),但通道仍然存在

如果频道即使在应用程序死亡后仍然存在,我如何检测到该频道未被创建