Git Product home page Git Product logo

flutter_dnd's Introduction

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.

flutter_dnd's People

Contributors

sathish76 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

flutter_dnd's Issues

Can't be combined with android_alarm_manager

Hi,

I combine flutter_dnd inside invocation method of android_alarm_manager, but it's failed with error message:

E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method isNotificationPolicyAccessGranted on channel flutter_dnd)
    #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
    <asynchronous suspension>
    #1      FlutterDnd.isNotificationPolicyAccessGranted (package:flutter_dnd/flutter_dnd.dart:26:27)

And this is my environment:

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-ID)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] VS Code (version 1.43.1)
[√] Connected device (1 available)

• No issues found!

Any help would be appreciated.

app is not showing up in dnd access

I have tried this on two phones vivo and tecno.

It navigates to do not disturb access but my app is not appearing in the list
PHOTO-2022-05-04-15-36-36

Help is appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.