alarmmanager

AlarmManager doesn`t start BroadcastReceiver

杀马特。学长 韩版系。学妹 提交于 2019-12-24 02:34:24
问题 I am trying to use BroadcastReceiver and AlarmManager to set a one-shot alarm. I have no idea why isn`t it working. What am I doing wrong? I have no exceptions, no logs about, no suggestions from IDE, everything seems fine, but onReceive method in my BroadcastReceiver is never called. public void setAlarm(Context mContext) { AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(mContext, AlarmReceiver.class); PendingIntent

AlarmManager triggers PendingIntent too soon for the second time

一个人想着一个人 提交于 2019-12-24 01:54:35
问题 I have this code: set alarm: public void setAlarm() { Calendar Calendar_Object = Calendar.getInstance(); Calendar_Object.add (Calendar.DAY_OF_YEAR, 1); Calendar_Object.set(Calendar.HOUR_OF_DAY, 0); Calendar_Object.set(Calendar.MINUTE, 0); Calendar_Object.set(Calendar.SECOND, 1); Intent myIntent = new Intent(Main.this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(Main.this, 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager =

How to use Android's Sensor Batching without AlarmManager

拟墨画扇 提交于 2019-12-23 17:19:05
问题 I want to use Androids sensor batching introduced in Android 4.4 to save some battery power. My testing device can store 184 sensor events in its fifo-queue. Using a sampling rate of 18 events/seconds I have to flush the sensor about every 10 seconds. The section on Sensor Batching in the 4.4 Documentation proposes: Use that calculation to set wake alarms with AlarmManager that invoke your Service (which implements the SensorEventListener) to flush the sensor. Since Android 5.1 the minimum

AlarmManager.setExact() starts in wrong time?

百般思念 提交于 2019-12-23 17:16:35
问题 I schedule pendingIntent to be sent in 5 seconds, but it starts in 23 seconds. API=19 (AlarmManager.setExact(...)): 10-23 16:43:44.638 11903-11903/? D/MainActivity﹕ Fri Oct 23 16:43:44 GMT+05:00 2015: scheduled in 5000 ms 10-23 16:44:07.728 11903-11903/? D/MainActivity﹕ Fri Oct 23 16:44:07 GMT+05:00 2015: fired private PendingIntent pendingIntent; private int SCHEDULE_REQUEST_CODE = 1; private static final String SCHEDULER_ACTION = "android.intent.action.FOTA_SCHEDULE_CHECK"; private void log

Android AlarmManager and DST/Timezone/Time change?

送分小仙女□ 提交于 2019-12-23 09:30:45
问题 I'm coding an alarm clock application, and i would like to know what happens, when I set some alarm with AlarmManager for example at time 2:59am (this is not time of my alarm, this is only time WHEN i set some alarm), and at 3:00am there will be automatic time change from summer time to winter (DST). What happens with my scheduled alarm? I found nothing in docs, and it's not so easy to test, at least I must change dates and wait few hours...I'm not so patient ;) Next problem - I was also

Android Alarm Manager not working with specific date and time

本小妞迷上赌 提交于 2019-12-23 06:14:46
问题 So I have been working on medication intake app, where I need to remind the user locally ( no internet/push notification needed) about taking their medication. I am using Android Alarm manager for this. Below is the code Note I am trying to schedule the alarm for a specific date: "13 July 2018 at 3h30 PM" . I schedule and wait but the reminder didn't fire (so not broadcast) however if I used AlarmManager.ELAPSED_REALTIME_WAKEUP with a defined amount of millisecond it does fire ( but

Service and AlarmManager

大兔子大兔子 提交于 2019-12-23 06:14:37
问题 here is what am trying to accomplish and badly failing at it. I need to: -start a service -do some tasks -set AlarmManager to start the service again after a set period of time -stop the service the problem I'm having is that the service is being re-started almost immediately it is being stopped. All I want is that the service should start after the alarm goes off.. Here is the code:- Intent intent = new Intent(ThisService.this, ThisService.class); PendingIntent pendingIntent = PendingIntent

Resetting alarms on reboot

六月ゝ 毕业季﹏ 提交于 2019-12-23 05:41:51
问题 User can create different alarms. So it's up to user when to keep alarm and he can keep multiple alarms and I maintain all the scheduled alarms in a database and show to the user for further reference. Below is my code. if("CREATEONCE".equals(strparam1)) { am.set(AlarmManager.RTC_WAKEUP, l2, pi);// l2 is time in millis }else if("CREATEREPEAT".equals(strparam1)) { am.setRepeating(AlarmManager.RTC_WAKEUP, l2, 86400000 , pi); //l2 is time in millis } So this is the code which sets the alarms.

Android Notification with AlarmManager, Broadcast and Service

廉价感情. 提交于 2019-12-23 05:40:22
问题 this is my code for menage a single notification: myActivity.java public class myActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mylayout); cal = Calendar.getInstance(); // it is set to 10.30 cal.set(Calendar.HOUR, 10); cal.set(Calendar.MINUTE, 30); cal.set(Calendar.SECOND, 0); long start = cal.getTimeInMillis(); if(cal.before(Calendar.getInstance())) { start += AlarmManager.INTERVAL_FIFTEEN_MINUTES;

Xamarin Android - How to schedule and alarm with a BroadcastReceiver

点点圈 提交于 2019-12-23 05:30:07
问题 (I'm asking here because I didn't get help at Xamarin forums) I'm creating an alarm with this code: Intent alarmIntent = new Intent(context, typeof(AlarmReceiver)); notificationClickIntent = PendingIntent.GetActivity(context, 0, new Intent(), 0); pendingIntent = PendingIntent.GetBroadcast(context, 0, alarmIntent, PendingIntentFlags.UpdateCurrent); am = (AlarmManager)Android.App.Application.Context.GetSystemService(Context.AlarmService); DateTime setTime = new DateTime(temp.Ticks + offset); /