Alarm clock without detaching from Expo

I am working on an alarm clock using react native with expo. As I understand, I would need to run a background process to listen to scheduled alarms and then trigger them. From what I found, react native doesn’t support background process using setTimeout but expo does seem to have an Calendar and BackgroundFetch API which might be useful.

Unfortunately BackgroundFetch isn’t available in bare expo (non-manage) apps so that’s out of question. I pretty much need standard alarm functionality so what are the possible ways it can be done without detaching from expo?

1 Like

hi. i have this issue too. did you find any solution?

Noup. You’re the first one who responded. From the docs, it’s evident that background tasks (such as alarm) where device is sleeping aren’t support by RN. I was hoping someone must have devised or come across a workaround.

I believe the closest thing Expo has to scheduling an alarm would be scheduling a local notification:

I’m trying to achieve something similar. I’ve been using local scheduled notifications but I’m having problems with accuracy. Often (through not always) there’s a delay of up to a minute between the time I schedule the notification for and the time it actually triggers. I can’t figure out what’s causing the delay, or whether it’s just down to the fact scheduled notifications aren’t accurate enough for this kind of use case. @smartidiot did you find any solution that worked for you in the end?

1 Like

I Think the main problem with local notifications is that the sound is no alarm and can not be spcified. I would also need a proper alarm clock that can be snoozed like normal alarm clocks in the system. Would be cool to not have to eject only for this simple purpose. Is this really something that nobody needs? Seems pretty basic to me, to be honest (but I also do not develop apps for a living, so there is that :wink: )

Unfortunately, I’ve notice the exact same problem! :frowning:
I’ve commented the following bug:

1 Like