I’m coding an alarm app using Flutter (Android only, for now).
I managed to play the alarm using a notification. But it only works when the phone isn’t in Silent Mode.
Is there a way to build such an app using Flutter? Playing the sound no matter the state of the phone is the core functionality of the app. If this isn’t possible, I should stop the development of this app.
Already tried using a sound played by AwesomeNotifications plugin (using Alarm Type with max priority) and a sound played by FlutterRingtonePlayer (triggered by a notification).
Flutter 3.3.5 • channel stable
Physical device used to test is running Android 13
Edit: as the app is an alarm, an isolate will play the sound.
3
Answers
You should call this when you start your alarm(you should call this in native code)
1-Add sound_mode as a dependency in your pubspec.yaml file
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
sound_mode: ^2.0.2
2-Add the following permission to AndroidManifest.xml for the app to appear in the ‘Do Not Disturb Access’ list :
To change the device’s sound mode:
Once try with this because this package is providing functionality to work in silent mode also.
https://pub.dev/packages/assets_audio_player
https://i.stack.imgur.com/qbjFB.png
I hope this things are solve your issue.