flutter_mute

Last updated:

0 purchases

flutter_mute Image
flutter_mute Images
Add to Cart

Description:

flutter mute

flutter_mute #
A Flutter plugin to check or toggle a device ringer mode.
Features #

Detect device current ringer mode;
Able to toggle between Normal, Silent & Vibrate mode (Only for Android);
Grant notification policy access for devices above platform version Android 7.0 (API 24).

List of modes available



Mode
Description




RingerMode.Normal
Device normal mode


RingerMode.Silent
Device silent mode


RingerMode.Vibrate
Device vibrate mode



Example #
To get the device's current sound mode:
import 'package:flutter_mute/flutter_mute.dart';

RingerMode ringerMode = await FlutterMute.getRingerMode;
copied to clipboard
To change the device ringer mode:
import 'package:flutter_mute/flutter_mute.dart';

await FlutterMute.setSoundMode(RingerMode.Silent); // Ignore for Android < 7.0
copied to clipboard
For Android 7.0 and above
For devices with Android 7.0 and above, it is required for the user to grant notification policy access to set their device's sound mode.
To check if the user has granted the permissions and prompt for approval
import 'package:flutter_mute/flutter_mute.dart';

bool isAccessGranted = await FlutterMute.isNotificationPolicyAccessGranted;

if (!isAccessGranted) {
// Opens the notification settings to grant the access.
await FlutterMute.openNotificationPolicySettings();
}
copied to clipboard
Note #
IOS Simulator always return normal mode.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.