Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Android Studio Multiple Alarm and SQlite, Need help with creating multiple alarm

views
     
TSshahafnan P
post Apr 21 2019, 01:48 PM, updated 5y ago

New Member
*
Probation
3 posts

Joined: Apr 2019


I need to build an apps that trigger an multiple alarm that being store in the Sqlite database, what i have done i manage to input a date/time into the sqlite database, but i dont know on how to retrieve this date/time an make it trigger the alarm. I have try and learn on how to make simple alarm but with only 1 alarm set based on a time picker not from date/time from sqlite datebase .Can anybody give me some tips and guide on how to retrieve the date/time from the sqlite then make the alarm trigger based on the date/time from sqlite. btw i read from other forum that said it more easy to store the alarm and retrieve it in milisecond rather then other format, can anyone explain to me why is that.

Sorry because im asking to much because im still new in learning programing.

dewill
post Apr 21 2019, 02:11 PM

Regular
******
Senior Member
1,716 posts

Joined: Feb 2006


since you can manage to store then you should using the same process to retrieve and compare with current date/time. well, without your way of coding, I can really give more further advice. Since you may build with pure android, ionic or react?
kingkingyyk
post Apr 21 2019, 06:19 PM

10k Club
Group Icon
Elite
15,425 posts

Joined: Mar 2008
QUOTE(shahafnan @ Apr 21 2019, 01:48 PM)
I need to build an apps that trigger an multiple alarm that being store in the Sqlite database, what i have done i manage to input a date/time into the sqlite database, but i dont know on how to retrieve this date/time an make it trigger the alarm. I have try and learn on how to make simple alarm but with only 1 alarm set based on a time picker not from date/time from sqlite datebase .Can anybody give me some tips and guide on how to retrieve the date/time from the sqlite then make the alarm trigger based on the date/time from sqlite. btw i read from other forum that said it more easy to store the alarm and retrieve it in milisecond rather then other format, can anyone explain to me why is that.

Sorry because im asking to much because im still new in learning programing.
*
You need a daemon.
Way 1 -> Periodically query the database for the time, trigger if needed.
Way 2 -> Hook into database operation (write a wrapper?), update/register timer to the next trigger time.
malleus
post Apr 21 2019, 10:31 PM

Look at all my stars!!
*******
Senior Member
2,096 posts

Joined: Dec 2011
Look up Android's AlarmManager class.

You can use your DB as your master storage for all the alarms that you create, but after doing all of that, you'll still need to schedule all your alarms using AlarmManager
bumpo
post Apr 23 2019, 04:43 PM

On my way
****
Junior Member
632 posts

Joined: Mar 2013


conceptually there are few ways you can achieve this

1) you check at a fixed interval if you got any alarms to trigger. e.g every minute you check if you got any entries that matches current time. if yes, ring alarm, if none, do nothing
2) you "pre load" your alarms and wait for them to fire off. e.g. when new entry is added, you create a thread that goes to sleep for the duration from current time till the time the alarm needs to go off

which approach are you going for? hmm.gif

 

Change to:
| Lo-Fi Version
0.0122sec    0.28    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 02:48 PM