alarm icon indicating copy to clipboard operation
alarm copied to clipboard

Uses the default alarm of system

Open warrenrhodes opened this issue 11 months ago • 8 comments

Each device alarm system is unique, and it should be great to let the user give the alarm path or not. Without an alarmPath, the default alarm system will be used.

warrenrhodes avatar Sep 03 '23 14:09 warrenrhodes

Hi @warrenrhodes,

Sorry for the late reply.

I'm not sure to understand your request. You would like the plugin to have a default alarm sound in case the user does not specify one ? Please explain with more details.

gdelataillade avatar Nov 01 '23 14:11 gdelataillade

@gdelataillade Yeah. At the time I wanted to use this package, the assetAudioPath field was required, so I'm wondering if the user wants to use a currency's default notification song, how does he do it?

warrenrhodes avatar Nov 01 '23 15:11 warrenrhodes

The issue is that Flutter itself doesn't provide a direct API to access the default system sounds for alarms, notifications, or ringtones on either iOS or Android.

However, I could import the alarm audio files it in the plugin itself but it would add weight to the plugin which is not ideal.

What do you think ?

gdelataillade avatar Nov 02 '23 14:11 gdelataillade

@gdelataillade Oh i see. Can you provide the same approach as FlutterLocalNotification package (use the default sound in case of null file)? If not, I have a preference for your first approach, passing the sound file.

warrenrhodes avatar Nov 13 '23 15:11 warrenrhodes

The issue is that I can't just play the default notification sound because the plugin relies on the fact that I have an audio file to play at a given time. If it was not the case, alarm would less reliable (app background processes would be killed).

On iOS: Audio Background Mode On Android: Foreground Service with type mediaPlayback

gdelataillade avatar Jan 15 '24 15:01 gdelataillade