diff --git a/lib/main.dart b/lib/main.dart index d953455..02c31bd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -59,6 +59,7 @@ class _EggTimerScreenState extends State { void initState() { super.initState(); _audioPlayer = AudioPlayer(); + _configureAudioContext(); _initLocationAndAltitude(); _loadAppVersion(); } @@ -180,6 +181,24 @@ class _EggTimerScreenState extends State { } } + Future _configureAudioContext() async { + await AudioPlayer.global.setAudioContext( + AudioContext( + android: const AudioContextAndroid( + isSpeakerphoneOn: true, + stayAwake: false, + contentType: AndroidContentType.sonification, + usageType: AndroidUsageType.alarm, + audioFocus: AndroidAudioFocus.gainTransient, + ), + iOS: AudioContextIOS( + category: AVAudioSessionCategory.playback, + options: {AVAudioSessionOptions.defaultToSpeaker}, + ), + ), + ); + } + String _formatDuration(Duration d) { final m = d.inMinutes.remainder(60).toString().padLeft(2, '0'); final s = d.inSeconds.remainder(60).toString().padLeft(2, '0'); diff --git a/pubspec.yaml b/pubspec.yaml index a66a8f3..c10ad39 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.9.10 +version: 0.9.11 environment: sdk: ^3.10.1 diff --git a/release/eggtimer.apk b/release/eggtimer.apk index 418557c..b5c8e5e 100644 Binary files a/release/eggtimer.apk and b/release/eggtimer.apk differ