I want to make my application set alarms every day at lets say 7 am a list of pills for the user. So far I have been doing it when a user adds a new pill, I will set the alarm directly, but I want to make it set alarms for today only. I am able to get a list of pills for some day using xpath, and getting the pills in a list. Now I was thinking if this is feasible to have some kind of hidden activity that keeps running or something that will set the daily pills. If someone could give me directions as to what I should be looking for to solve this problem, any kind of help would be appreciated.
Setting alarms daily android
188 Views Asked by hakuna matata At
2
There are 2 best solutions below
0
Naddy
On
I will give an idea for this.
Schedule the first
Alarmat 7 am using the set method ofAlarmManagerand register aBroadcastReceiverto be executed at 7 am using the sameAlarmManager.At 7 am your
AlarmandBroadcastReceiverwill execute. In theonReceivemethod of yourBroadcastReceiveragain set theAlarmandBroadcastReceiverso that it becomes a self loop.
pseudo code to set broadcastReceiver class:
Intent intent = new Intent(this, broadcastReceiver.class);
intent.putExtra("subject", subject);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this,
0, intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager am= (AlarmManager) getSystemService(Context.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, "Your specific time", pendingIntent);
broadcastReceiver.class:
public class TimeAlarm extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//set the alarm and broadcast receiver again
}
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in ANDROID-ACTIVITY
- Jetpack Compose how to reverse edge-to-edge when leaving composition
- In Android Studio, how make an item in the recyclerview open another activity when clicked?
- How to detect the Minimization of Custom Chrome Tabs on Android?
- Activity status in Node js
- setTaskDescription does not change the icon
- How to launch android activity in background, or minimized, when screen locked in Android 14 and start the activity with broadcast intent
- Window Manager cant create view
- Android AppWidget PendingIntent Activity Transition Animation
- How to clear intermediate activities in Android?
- How to add two activity in android studio using Kotlin?
- How to hide Android systembars & navigationbars without blocking floating widgets from being closable?
- Which Android component to use for orchestration (automatism)?
- onNewIntent() method called multiple times
- Google Files not respecting singleInstance launchMode
- Switch off noHistory="true" programmatically
Related Questions in ALARMMANAGER
- Flutter alarm_android_manager_plus not showing my notification?
- Why do we need to pass PendingIntent to both AlarmClockInfo and setAlarmClock()?
- Requesting permissions for schedule exact alarms and send notifications in Android 14
- OnePlus Watch 2 force stop my application when screen turns of and it cancels all scheduled alarms
- Getting Scheduled Alarms from Default Alarm Clock App (specifically Clock on Android)
- App crashes while trying to run AlarmManager and PendingIntent
- How to read "adb shell dumpsys alarm" output - Android 13
- Set a background alarm for the near future Android
- Embarcadero and Delphi on Android: Using AlarmManager
- SetAlarmClock() on Xiaomi
- Android 14 SCHEDULE_EXACT_ALARM default disabled and user runtime permission is not working
- SetAlarmClock(). We need a working, current and proven example of using
- how to add a screen when the screen is off like the default alarm screen when the alarm ring with flutter, alarm screen is not its not coming
- How to update notification power efficiently every minute to display time in hour and minute in Android?
- Issue on Android 13 : Android — Repeat notification daily on specific time
Related Questions in ANDROID-ALARMS
- OnePlus Watch 2 force stop my application when screen turns of and it cancels all scheduled alarms
- SCHEDULE_EXACT_ALARM warning despite not scheduling it
- How to read "adb shell dumpsys alarm" output - Android 13
- SetAlarmClock() on Xiaomi
- SetAlarmClock(). We need a working, current and proven example of using
- Android - Alarm Manager and DST changes
- Alarm not displaying a notification or playing a sound, even though it is set
- why setRepeating() in AlarmManager is not showing alarm-notifications at exact time
- in flutter, android.intent.action.SET_ALARM action from android_intent_plus plugin not executing when the app in recent tabs or closed or background
- How do I get the Alarm Class to Trigger Properly Everytime?
- How to set every day to repeat the alarm in alarm manager for flutter?
- Full Screen Notifications Android Kotlin
- AndroidAlarmManager.cancel does not working
- Wake up the app when there are changes in specific external storage folder in the background
- Flutter android alarm manager plus works in emulator periodically but not working in real device?
Related Questions in ALARMS
- Generate alarms and notifications and send mail based on a condition in Python
- Why alarms are not working when setting for next day and for long hours,when device is inactive for long duration the alarms are not fired
- AlarmManager.setAlarmClock throws alarms at wrong time?
- Send an email when an alarm is cleared
- How to store and delete alarms for respective object
- Adding multiple reminders causes them to trigger at the same time
- Boto / Cloudwatch recover instance alarm
- Manage multiple alarms in the broadcastReceiver
- Android alarmmanager set alarms in specific days and repeat them all the weeks
- Run method when Android Alarm goes off
- Simple Alarm Clock in Ruby on Rails 4
- Multiple Alarms fired as one in an intent (List View)
- How to cancel alarms after app was closed
- is there a way to set the system timer in swift
- Can we play alarm ringtone using EventKit?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You should use: Alarm Manager. And place it in Service. Read also about BroadcastReceiver