alarmmanager

Android AlarmManager - Cancel from another Activity

社会主义新天地 提交于 2019-12-04 20:41:20
I have a Homework Planner application which I want to create an Alarm for to remind users of the homework the night before/at a certain time. I have an Activity called AddNewHomework which is where the user creates a new homework item and it is added to the database. This code is then called. Intent i = new Intent(this, AlarmNotificationReceiver.class); i.putExtra("title", title); PendingIntent pi = PendingIntent.getBroadcast(this.getApplicationContext(), (int) id, i, 0); AlarmManager mAlarm = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE); mAlarm.set

AlarmManager & onStartCommand

£可爱£侵袭症+ 提交于 2019-12-04 20:22:43
I develop a GPS Tracking app on android. I use AlarmManager to wake up the device every 5 minutes. I developed a log file that shows that the application works great until a moment when I receieve public int onStartCommand(Intent intent, int flags, int startId) with startId = 1 again .... in this case I noticed that all variables are reset so I initialize all variables again .. the issue is that once this happens I keep getting same event with startID = 1 again and after few calls the app just stops until i open the ActivityForm and bind with service again !!! the log is here for the bad

setAlarmClock not exact in android marshmallow

前提是你 提交于 2019-12-04 19:10:47
I use setAlarmClock method of Alarmmanager for do alarm clock application. When I set alarm clock from 6.00 AM and alarm in 6.01 AM . It delay and not exact. Code when setAlarmClock . Intent intent = new Intent(getBaseContext(), AlarmReceiver.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.putExtra(AppConstant.REMINDER, note.convertToString()); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), note.getId(), intent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); if (Build

I need to implement Notification Reminder in my android app

人走茶凉 提交于 2019-12-04 18:59:12
My Requirment: I want my application to show a reminder notification on every Friday @ 8 am I have used AlarmManager, BroadcastReceivers to implement my reminder notification. The problem I am getting is, When I set notification time using current system time and Add 2 minutes in it... It works perfectly when I use it in this way, it trigger my notification exactly after 2 minutes. But, When I use calender instance to set notification time at specific time of any day, it trigger my reminder notification when ever I start/open my app on my device/emulator and secondly it wont trigger

Android: Pending intent not calledon snooze with multiple alarm

ぐ巨炮叔叔 提交于 2019-12-04 18:33:31
I am working on adding multiple alarm functionality in my existing app. Earlier, the alarm was single only and every thing worked fine. I have been able to set multiple alarms, it is working fine too, but problem is with snooze feature. Earlier, snooze was working perfect. But, after multiple alarm implementation it is not working. I never get dialog for snoozing alarm, once I press snooze button. Here is my code: Set alarm method public void setAlarm(boolean AlarmEnabled, int AlarmHour, int AlarmMin) { //Build Intent/Pending Intent for setting the alarm Intent AlarmIntent = new Intent

how to repeat alarm after 1 day in android

那年仲夏 提交于 2019-12-04 17:04:40
I m using the alarm manager in my app and i want to repeat alarm after one day. the alarm should be invoked after one day when invoked once by time.Please help. Thanks in advance. if(str_freqSchedule.equals(checkForDaily)){ Calendar calendar = Calendar.getInstance(); //calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR)); calendar.set(Calendar.HOUR_OF_DAY, hr); calendar.set(Calendar.MINUTE, min); calendar.set(Calendar.SECOND,0); Intent intent = new Intent(this, AlarmReceiverActivity.class); PendingIntent pendingIntent = PendingIntent.getBroadcast( this.getApplicationContext()

Android background service and AlarmManager

拥有回忆 提交于 2019-12-04 17:02:18
I am coding an android application that gets the user position every 5 minutes, stores it in the database and sends it to a server. I have read many ways of doing it, I was going to do the following: User starts the application The main UI activity starts a service. The service runs in background and keeps turning on and off the gps, and creating new threads that will save to database,and send the data to the server. But I have seen that it can be done with a "Remote service" (http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.html) or with

Is there an accurate repeating-alarm system for Android?

有些话、适合烂在心里 提交于 2019-12-04 16:58:13
Background I'm currently developing an application for Android which revolves around an alarm that goes of on an user specified time. My intent for it is that it will be used for waking people up in the morning (and the following morning - aka repeating alarm). When the alarm goes of it will call an Activity that has a couple of options (such as snooze). I've got all of this working but I'm running in to a problem. Problem I'm using AlarmManager to handle my alarm needs. There is however something curious going on with the class (in my opinion). There are two adviced ways to handle the setting

How to reschedule Alarm Manager on Preference Change

淺唱寂寞╮ 提交于 2019-12-04 13:38:54
I have an Android Service. When a phone boots up, a broadcast receiver receives a notification and it schedules the service to run repeatedly at a gap of X minutes. Henceforth After every X minutes another broadcast receiver gets those notifications and kicks the service off, which does it's job and quits. So far so good. Now I want those X minutes to be configurable. I have a perf.xml similar to what is given at the link below. This XML captures all my preferences along with that of service timer. http://android-journey.blogspot.com/2010/01/for-almost-any-application-we-need-to.html Now when

i want to post location updates every 15mins to server even when the app is not running in the foreground [closed]

拥有回忆 提交于 2019-12-04 13:14:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I want the location updates to be sent to the server every 15mins to time interval from android phone to the server.Is the service or the alarm manager is the best option. If i start a service,can i start an asynctask to post locations to the server.? here is the code i used : @Override public void onStart