alarmmanager

Stop pending intent

杀马特。学长 韩版系。学妹 提交于 2020-01-16 13:19:50
问题 I have one service which is running every 5 minutes so every 5 minutes service is started and do some work and then finish and again after 5 minutes it will be started because i have set interval time of repeat to 5 minutes Now if i want to stop that service and if i don't want to start service any more then what i have to do? Please help me? 回答1: You should perfrom cancel() on the pendingIntent. 来源: https://stackoverflow.com/questions/5754199/stop-pending-intent

“Alarm Manager Set repeating” is not repeating under 1 minute?

不羁的心 提交于 2020-01-16 08:06:40
问题 I am trying to set a background service with alarm manager. Intent alarmIntent = new Intent(this, AlarmReceiver.class); PendingIntent pending = PendingIntent.getBroadcast(this, 0, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); alarmManager.cancel(pending); //alarmManager.SetExact(AlarmType.RtcWakeup, SystemClock.ElapsedRealtime() + 5 * 1000, pendingIntent); alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME

AlarmManager or Handler

别来无恙 提交于 2020-01-16 00:49:08
问题 I have specific case to ping my server every 10-60 minutes (it still depends) but only when app is opened. This feature is created to inform that session is still open where session is defined as period from app open to app close. I don't have to worry about process kill. What is better to use ? AlarmManager or Handler .postDelayed() ? The targeted platform is android tv so imagine the case is when watching film in context of my app for example. Personally I first thought to use AlarmManager

Could AlarmManager.setInexactRepeating not broadcast intents when the device is in sleep mode?

时光总嘲笑我的痴心妄想 提交于 2020-01-15 16:35:31
问题 I have a very simple class that sets and cancels an AlarmManager to broadcast intents: public class MyIntentsAlarm { public void setAlarm(Context context){ AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent("MY_ACTION"); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),5*60*1000L, pi); } public void cancelAlarm(Context context){ Intent intent = new

Could AlarmManager.setInexactRepeating not broadcast intents when the device is in sleep mode?

徘徊边缘 提交于 2020-01-15 16:34:59
问题 I have a very simple class that sets and cancels an AlarmManager to broadcast intents: public class MyIntentsAlarm { public void setAlarm(Context context){ AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent("MY_ACTION"); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),5*60*1000L, pi); } public void cancelAlarm(Context context){ Intent intent = new

Could AlarmManager.setInexactRepeating not broadcast intents when the device is in sleep mode?

蹲街弑〆低调 提交于 2020-01-15 16:32:38
问题 I have a very simple class that sets and cancels an AlarmManager to broadcast intents: public class MyIntentsAlarm { public void setAlarm(Context context){ AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent("MY_ACTION"); PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0); am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),5*60*1000L, pi); } public void cancelAlarm(Context context){ Intent intent = new

Android AlarmManager and BroadcastReceiver running in background Service

a 夏天 提交于 2020-01-15 15:15:47
问题 I'm currently having a problem integrating AlarmManager and BroadcastReceiver. Im my app, I'm running a background service that runs regardless that app is running or not. I think I get this part working fine. The background service keeps an array that changes based on user's location. However, at 8:00am everyday, I want the app to reset the array variable to default. After much looking around online, it seems like the way to do this is via AlarmManager (to initiate the task every 8:00am) and

Android AlarmManager and BroadcastReceiver running in background Service

会有一股神秘感。 提交于 2020-01-15 15:11:54
问题 I'm currently having a problem integrating AlarmManager and BroadcastReceiver. Im my app, I'm running a background service that runs regardless that app is running or not. I think I get this part working fine. The background service keeps an array that changes based on user's location. However, at 8:00am everyday, I want the app to reset the array variable to default. After much looking around online, it seems like the way to do this is via AlarmManager (to initiate the task every 8:00am) and

Android AlarmManager and BroadcastReceiver running in background Service

二次信任 提交于 2020-01-15 15:11:47
问题 I'm currently having a problem integrating AlarmManager and BroadcastReceiver. Im my app, I'm running a background service that runs regardless that app is running or not. I think I get this part working fine. The background service keeps an array that changes based on user's location. However, at 8:00am everyday, I want the app to reset the array variable to default. After much looking around online, it seems like the way to do this is via AlarmManager (to initiate the task every 8:00am) and

Alarm manager trigger every time app running

假如想象 提交于 2020-01-15 03:21:25
问题 I want to create a repeating alarm from AlarmManager which is triggered at 21:00 every day to show a notification. So i create a service and declare that in manifest, in the service class i wrote a method for schedule repeating alarms. public static void setRecurringAlarm(Context context) { AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, NotificationService.class); PendingIntent pi = PendingIntent.getService(context, 0, i, 0);