alarmmanager

Alarm in the AlarmManager get erased when process is killed

[亡魂溺海] 提交于 2020-01-14 09:00:35
问题 I'm a newbie in android so please bear with me. My Main activity creates and alarm in the alarm manager which supposed to fire in specific time, my main Activity also create Broadcast receiver which suppose to receive the Intent that the alarm fired, everything is working good until Task manager killing my App. I've check the PendingIntent list in the AlarmManager and verify that my alarm is getting erased from the Alarm Manager, I try to add service and register alarm from the service, I've

Keep android alarms alive, even after process killed by a task manager

安稳与你 提交于 2020-01-13 03:24:22
问题 I am writing an alarm program. My problem is task managers, like advanced task manager or Samsung task manager, remove my alarms when clearing memory. Is there any way of preventing task managers from removing my alarms? Or a way to be notified of "clear memory" and forcing app to recreate alarms again. 回答1: In short, no. You can re-register your alarms when the user starts your app again, or when the phone is rebooted. 来源: https://stackoverflow.com/questions/7551287/keep-android-alarms-alive

Does Android AlarmManager handle daylight saving changes?

房东的猫 提交于 2020-01-12 09:13:09
问题 I'm building an alarm clock app in Android. Does AlarmManager automatically handle clock changes between summertime and wintertime or do I need to manage that explicitly? edit: If an alarm is set where the repeat interval crosses a clock change will that alarm need to be rescheduled? 回答1: AlarmManager will take care of the day light saving. It reset the Timezone info at the beginning of each day taking daylight saving info into consideration. 回答2: As opposed to what the accepted answer says I

Android Notifications triggered by Alarm Manager not Firing when App is in Doze Mode

半腔热情 提交于 2020-01-12 04:00:20
问题 I have the following requirements. A user needs to be able to schedule a recurring reminder in my app that will trigger a push notification at an exact time every day. This is one of those questions that I hoped I would end up not submitting as similar questions were recommended while writing it. However several team members have spent hours and hours looking through the Android Developer Docs and Stackoverflow and we seem no closer to an answer, so here we are. If I create a reminder and set

i want to update my sqlite and firebase database every hour?

独自空忆成欢 提交于 2020-01-11 11:17:54
问题 I want to update my local sqlite and firebase database every hour. But I can't use the broadcast receiver as it was ban in android o. I can't use Job scheduler and work manager as it is a timebase application. I don't want to foreground service because it will use lots of resources and required to show a notification that I can't show. 来源: https://stackoverflow.com/questions/57826280/i-want-to-update-my-sqlite-and-firebase-database-every-hour

alarm and notification not triggered at specified time

感情迁移 提交于 2020-01-11 07:57:21
问题 I am trying to trigger a notification and an alarm at a specified time. I have put log information to console to see if the correct time is being set and it is fine. However, still the alarm is not being triggered. Please help. / Code for Creating Notification and Alarm / btn_add_task.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { db.addTask(new DataModel(input_task_title.getText().toString(),input_task_desc.getText().toString(), checkBox.isChecked(

Service that runs every minute

家住魔仙堡 提交于 2020-01-10 07:53:07
问题 I have a service that I am wanting to execute a task every minute in the background. It does not need to execute the task whenever the phone is asleep, only when the user is actively using it. I am trying to do this with an IntentService which is set up as follows: public class CounterService extends IntentService{ public CounterService() { super("CounterService"); } @Override public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent,flags,startId);

Alarm manager don't work after some time

南笙酒味 提交于 2020-01-10 04:37:07
问题 This is my code. It works correctly, but after some time (about 1 hour) it doesn't work. Whats wrong? Thanks in advance. <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> public class Alarm extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "Alarm !!!!!!!!!!!!!", Toast.LENGTH_LONG).show(); } public void SetAlarm(Context context) { AlarmManager am=(AlarmManager)context.getSystemService

Save Alarm after app killing

余生颓废 提交于 2020-01-07 03:08:15
问题 Code that starts AlarmManager. AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, AlarmManagerBroadcastReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(context, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT); Its work fine, but when I kill my app in task killer, I lost my alarm. How to solve this problem? Here full code: 1. Its alarm reseiver: public class AlarmManagerBroadcastReceiver extends

How to check if AlarmManager is already working?

自闭症网瘾萝莉.ら 提交于 2020-01-06 15:53:27
问题 This qustion has been asked alot and i tried alot of the answer and didn't work so this is the most common one public void onClick(View v) { boolean alarmUp = (PendingIntent.getBroadcast(MainActivity.this ,0, new Intent(MainActivity.this,Notifications.class), PendingIntent.FLAG_NO_CREATE) != null); if (alarmUp) { am.cancel(pend); Intent alarmIntent = new Intent(MainActivity.this,Notifications.class); final PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0,