Alarm clock application in iphone and android using phonegap - android

While developing an iphone and android application using phonegap,came to a point where i have to build a alarm clock functionality like the image.
I am setting the alarm using Jquery which is running properly when user is in app. But it's not working when the app is closed or the phone is in sleep mode.
Is there any way to proceed?

I'm not sure if there is a phonegap equivalant, but in Android you'll need to use the AlarmManager for the alarms. This will launch your application when the alarm is triggered. You'll also need to set a WakeLock when you have active alarms. Otherwise the device can go into sleep mode and you won't get the alarms:
http://developer.android.com/reference/android/os/PowerManager.html
The Android Alarm uses the PARTIAL_WAKE_LOCK and only when there are active alarms.

Related

How to create alarms on a flutter application for Android and iOS?

I'm trying to make an app where my user would be able set multiple countdown timers and be alerted when they are finished.
It needs to keep running and be precise even if the app is closed.
It needs to ring (default alarm sound) and vibrate. Only vibrate if sound is off. But do both if the device is on Do Not Disturb mode (after all he set the alarms himself).
It needs to show a the alarm name and have a button to dismiss/turn it off even if screen is off or if he is using other apps.
Previously I was using a BroadcastReceiver to open an activity that would do all that, but it doesn't seem to be working with flutter using a channel and native code on Android.
And according to this I should use high priority notifications instead.
And I'm also kinda new to Flutter, so I've been trying with channels, pendingintents, broadcastreceivers and a second native activity to show the alarm message with a dismiss button. It's not working. It shows the native activity only if the flutter app is on foreground.
I see there are a few plugins like intents, Alarm_manager and local notifications for flutter that should do it but I can't find a way to fulfill all my needs with them.
So I'm asking the pros: what's the best way to achieve this?
For Android, you can use android_alarm_manager_plus package. On iOS however, there's no equivalent feature of Android's AlarmManager as it recommends to create a calendar event or reminder for an alarm. As a workaround, you can use flutter_local_notifications for scheduled notifications.

how to trigger a react-native app to wake up? (for alarm)

Basically I am trying to add an alarm feature to my app.
set time & date, save >> turn the app off >> when it's the time, RING-RING-!
But to do this, the app should wake itself to run the alarm feature; otherwise it won't work unless the app is running at the alarm time.
Any regular alarm apps just open itself when its the time, even when the app was not running on the phone. does anyone here know how apps self-wake?
Thanks very much
Use AlarmManager to do alarm envenif the app is not running.
But if the machine reboot, it will not work. So we need to run a service to register alarm when machine boot complete.

Access the device clock alarm settings?

My app needs to wake the user up in the night so I would like to access the device's clock alarm and add my own in there. The alarm times shifts throughout the month, so I would need to access it and update it.
For example, I would like to add a daily alarm in the device clock alarm. Then everyday, I would like to run some calculation and adjust the time for the daily alarm.
Is this possible? I found AlarmManager but this seems like a scheduler not the device clock alarm. Perhaps there is an intent for the clock alarm? The screenshot below is the setting I am trying to access from my app (without rooting the device).
Here you have a tutorial about programming alarms for Android.
https://developer.android.com/training/scheduling/alarms.html
The thing is that is not needed to access the native clock app to set them, you can do it with your own app.
Be aware that this will not program an "Alarm"(with music and so on), it will only provide you the possibility to shcedule some task. In your case this task could be wake up the user with a loud music or whatever.

Alarm clock like services

I want to develop an alarm clock like services in android that is the app should run on the some user entered time and even if the mobile is switched of that app should work as alarm clock works .
Use an AlarmManager. See this SO question. You'll also probably want to recreate your alarms on reboot (they're normally cleared then); see this android developers thread.

Android AlarmManager RTC doesn't pause while device is sleeping

I wrote a little widget for Android devices.
The widget uses AlarmManager to set recurring updates.
I'm using the RTC clock for the AlarmManager.
According to the documentation, if the device is sleeping, the RTC clock won't wake up the device and the next update will be when the device is woken.
I have a log file for the widget which shows when it was updated.
Even when I don't touch the device , I still see updates in the log file.
Why is that? shouldn't the device be sleeping and thus my widget shouldn't update?
I'm using System.currentTimeMillis() for the starting time so it should be correct for RTC clock.
You need to disconnect device from your desktop. When device is charging it doesn't go to sleep mode even when screen is black.

Categories

Resources