FLUTTER ECOSYSTEM

sathish76/flutter_dnd

一个用于管理 Android 上勿扰模式设置的 Flutter 插件。

flutter_dnd 项目封面
Stars
7
Forks
14
最近推送(UTC)
2021年11月13日
项目状态
未归档
Sathish GitHub avatar
GITHUB User

Sathish ↗

Mobile and Web Developer! Native Android & iOS, Flutter, Vue.js, Node.js

Chennai
语言DartJavaRubyObjective-C

此仓库发布的插件

使用的依赖

依赖清单 2 项
  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

flutter_dnd

pub package A Flutter plugin to manage Do Not Disturb settings on Android.

Usage

To use this plugin, add flutter_dnd as a dependency in your pubspec.yaml file.

Make sure you add the following permissions to your Android Manifest

<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>

Example

// Import package
import 'package:flutter_dnd/flutter_dnd.dart';

if (await FlutterDnd.isNotificationPolicyAccessGranted) {
	await FlutterDnd.setInterruptionFilter(FlutterDnd.INTERRUPTION_FILTER_NONE); // Turn on DND - All notifications are suppressed.
} else {
	FlutterDnd.gotoPolicySettings();
}
Other filters
Filter Description
INTERRUPTION_FILTER_ALL No notifications are suppressed.
INTERRUPTION_FILTER_PRIORITY Allow priority notifications.
INTERRUPTION_FILTER_NONE Suppress all notifications.
INTERRUPTION_FILTER_ALARMS Allow alarm notifications.