alarmmanager

handler.postDelayed vs. AlarmManager vs

ぐ巨炮叔叔 提交于 2020-01-01 19:27:09
问题 I have a minor problem in one of my apps. It uses a BroadCastReceiver to detect when a call finishes and then performs some minor housekeeping tasks. These have to be delayed for a few seconds, to allow the user to see some data and to ensure that the call log has been updated. I'm currently using handler.postDelayed() for this purpose: public class CallEndReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { if (DebugFlags.LOG

Is there an accurate repeating-alarm system for Android?

落爺英雄遲暮 提交于 2020-01-01 18:40:11
问题 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

Is there an accurate repeating-alarm system for Android?

…衆ロ難τιáo~ 提交于 2020-01-01 18:39:43
问题 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

different situations to use AlarmManager vs Handler Android

杀马特。学长 韩版系。学妹 提交于 2020-01-01 12:25:50
问题 Could someone explain me different situations to use AlarmManager vs Handler with examples please. Any disadvantages of using these two as alternate to each other? Thanks. 回答1: They have little to do with one another. I am assuming you are referring to using something like postDelayed() on Handler for polling, which is but one small feature of Handler . You would use postDelayed() (also available on any widget or other subclass of View ) in an activity for simple timing events that are within

Android, How to cancel an alarm? alarmManager.cancel not working

一世执手 提交于 2020-01-01 12:14:53
问题 I have an application where you can create 5 alarms where to be created are displayed in a ListView, and assume that when an element of listView the played alarm but should remove the item from the listview but the alarm is removed to reach the scheduled time always sounds. I have reviewed muchísmos tutorials and guides on how to remove the alarms but none helped me. To delete what I do is save the ID of each alarm in a sqlite database and when I give the alarm eliminiar what I do is I bring

Set an Alarm from My application

天涯浪子 提交于 2019-12-31 22:41:12
问题 I want to create an alarm object from my application. I am writing a To-Do application which will have an option to set an Alarm on the phone. I wanna set the Date and Time and also the Label for the alarm. Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); c.clear(); c.set(Calendar.YEAR, mYear); c.set(Calendar.MONTH, mMonth); c.set(Calendar.DAY_OF_MONTH, mDay); c.set(Calendar.HOUR, mHour); c.set(Calendar.MINUTE, mMinute); Intent activate = new Intent(this,

Android Alarm Manager is not working for Flutter Project App

隐身守侯 提交于 2019-12-31 13:17:07
问题 I have installed the Android Alarm Manager plugin in my New Flutter app. I use the example code of Plugin- but it gives error in console. Please suggest how to make android alarm manager plugins works. How do I Integrate the Dart's android_alarm_manager to the app so that users get alarm when the time they picked in the schedule reaches? I use the code from this link: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager ////// main.dart:///////// import 'dart:isolate'

AlarmManager working well in emulator but not in real device

不问归期 提交于 2019-12-31 06:20:14
问题 this is my code for setting alarm: public void SetAlarm(Context context, int tag, long time){ AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, Alarm.class); i.putExtra("position", tag); PendingIntent pi = PendingIntent.getBroadcast(context, tag, i, PendingIntent.FLAG_CANCEL_CURRENT); am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+ time, pi); // Millisec * Second * Minute } this is my onRecieve methode: public void

Android - start alarm service immediately?

别说谁变了你拦得住时间么 提交于 2019-12-31 06:08:15
问题 I have created an On Boot Receiver to repeatedly call a wakeful intent service every 5 minutes but cannot figure out how to start the service immediately when the app is installed..? I do not want to rely on the user rebooting their device before it starts to run! Here is my code so far : public class OnBootReceiver extends BroadcastReceiver { private static final int PERIOD = 300000; // check every 5 minutes @Override public void onReceive(Context context, Intent intent) { AlarmManager mgr =

How to Keep the CPU of android phone always awake?

隐身守侯 提交于 2019-12-31 02:43:10
问题 I have been stuck on it for days. I need to execute a function every minute. This function is making a POST call from the App to the Server and is transferring the location of the user per minute. The location coordinates are transferred for few hours, however, after few hours the transfer of location coordinates to the Server stops on its own. I am making use of WakefulBroadcastReceiver and IntentService to make sure that the CPU stays awake. I am also making use of Alarm to make sure that