Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.content.ComponentName; import android.provider.Settings; import android.text.TextUtils; public class Main { public static boolean checkNotificationReadPermission(Activity activity) { String notiStr = Settings.Secure.getString(activity.getContentResolver(), "enabled_notification_listeners"); if (notiStr != null && !TextUtils.isEmpty(notiStr)) { final String[] names = notiStr.split(":"); for (String name : names) { ComponentName cn = ComponentName.unflattenFromString(name); if (cn != null) { if (activity.getPackageName().equals(cn.getPackageName())) { return true; } } } } return false; } }