gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

Uses the default alarm of system #84

Open warrenrhodes opened 1 year ago

warrenrhodes commented 1 year ago

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.

gdelataillade commented 1 year ago

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.

warrenrhodes commented 1 year ago

@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?

gdelataillade commented 1 year ago

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 ?

warrenrhodes commented 1 year ago

@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.

gdelataillade commented 10 months ago

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

ShadichyDev commented 5 months ago

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

On Android, you can use RingtoneManager.TYPE_ALARM to get the URI of the default alarm sound. Same for TYPE_NOTIFICATION and TYPE_RINGTONE

IldySilva commented 4 months ago

@gdelataillade any updates about this one?? this a must

gdelataillade commented 4 months ago

@IldySilva I haven’t had time to work on this yet, but I see it is highly requested. I’ll increase its priority and keep you updated.