flutter_android_volume_keydown

Last updated:

0 purchases

flutter_android_volume_keydown Image
flutter_android_volume_keydown Images
Add to Cart

Description:

flutter android volume keydown

flutter_android_volume_keydown #
A simple flutter plugin for Android that listens to the volume up down button. It blocks the buttons from changing the volume while listening for events.
How to use #
Using the plugin is very simple:

Add flutter_android_volume_keydown to your pubspec.yaml
Change your MainActivity.java or MainActivity.kt to extend FlutterAndroidVolumeKeydownActivity
Implement a simple listener:

var subscription = FlutterAndroidVolumeKeydown.stream.listen((event) {
if (event == HardwareButton.volume_down) {
print("Volume down received");
} else if (event == HardwareButton.volume_up) {
print("Volume up received");
}
});
copied to clipboard
To stop listening:
subscription?.cancel();
copied to clipboard
While listening the Volume button events are not handled by Android, when you stop listening the buttons resume their normal functionality again.

License:

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

Customer Reviews

There are no reviews.