Welcome Guest ( Log In | Register )


Bump Topic Add Reply RSS Feed New Topic New Poll

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 2 months ago

New Member
*
Group: Probation
Posts: 1

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
******
Group: Senior Member
Posts: 1,658

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
Hardware
Group: Elite
Posts: 15,066

Joined: Mar 2008
From: Kepong


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

Regular
******
Group: Senior Member
Posts: 1,120

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

Casual
***
Group: Junior Member
Posts: 326

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



Bump Topic Add ReplyOptions New Topic
 

Switch to:
| Lo-Fi Version
0.0552sec    5.66    5 queries    GZIP Disabled
Time is now: 23rd May 2019 - 10:41 AM