gdelataillade / alarm

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

Uses the default alarm of system #84

Open warrenrhodes opened 10 months ago

warrenrhodes commented 10 months 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 8 months 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 8 months 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 8 months 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 7 months 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 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

ShadichyDev commented 3 weeks 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 5 days ago

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

gdelataillade commented 5 days 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.