Java Code Examples for androidx.core.app.NotificationManagerCompat#areNotificationsEnabled()

The following examples show how to use androidx.core.app.NotificationManagerCompat#areNotificationsEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactNativeNotificationHubModule.java    From react-native-azurenotificationhub with MIT License 5 votes vote down vote up
@ReactMethod
public void isNotificationEnabledOnOSLevel(Promise promise) {
    ReactContext reactContext = getReactApplicationContext();
    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(reactContext);
    boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled();
    promise.resolve(areNotificationsEnabled);
}
 
Example 2
Source File: NotificationUtil.java    From AppUpdate with Apache License 2.0 2 votes vote down vote up
/**
 * 获取通知栏开关状态
 *
 * @return true |false
 */
public static boolean notificationEnable(Context context) {
    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
    return notificationManagerCompat.areNotificationsEnabled();
}
 
Example 3
Source File: PermissionUtil.java    From AppUpdate with Apache License 2.0 2 votes vote down vote up
/**
 * 检查通知权限
 *
 * @return false 没有权限,需要申请
 */
public static boolean checkNotificationPermission(Context context) {
    NotificationManagerCompat managerCompat = NotificationManagerCompat.from(context);
    return managerCompat.areNotificationsEnabled();
}