alarmmanager

Alarm Notification fires instantly. Android

这一生的挚爱 提交于 2019-12-21 04:17:50
问题 I am working on a Reminder that sends notification on fixed time to the user. The alarm is getting off instantly ... I tried most of the suggestions over stackoverflow , but still having same issue Please help me sort this problem out. server data user_reminder": [ { "id": "75", "name": "Morning Snacks", "time": "11:00:00", "days": "1,2,3,4,5,6,7", "user_id": "14" }, { "id": "76", "name": "Lunch", "time": "13:00:00", "days": "1,2,3,4,5,6,7", "user_id": "14" }, ...... ] My code for (int i = 0;

AlarmManager repeating alarm missing randomly when phone is not in use

余生颓废 提交于 2019-12-20 12:27:42
问题 I am calling a background Service at interval of 30 min to read the latitude/longitude of current location and sending it to server by POST API . I am using setRepeating() method of AlarmManager class to schedule alarm every 30 minutes. But some times the alarm is getting missed and service is not called. To monitor if alarm gets called or not in every 30 min I have generated Log.txt file in the sdcard. For every time alarm called the entry for the current time will be written in the Log.txt

How Google calendar or Instagram make their apps all the time up and running even after force stop

白昼怎懂夜的黑 提交于 2019-12-20 11:36:54
问题 Looks like force stop should prevent app from running and it's even disable all app's alarms. However I found that notification in Google Calendar still shown fine even after force stop, and I all the time see Instagram app running, even when I kill it, it's just restart automatically and it's once again there. So, what is a way to make app running constantly? I'm doing app with reminders and need to show notifications in specific time, regardless how app was previously closed before. 回答1: If

Run volley request every 5 minutes in background android

别等时光非礼了梦想. 提交于 2019-12-20 10:57:28
问题 I use Volley library to connect with server in my app. Now, I have to send request in background every 5 minutes also when app is not running (killed by user). How should I do it? With background services, AlarmManager (Google says that it isn't good choice for network operations) or something else? Or maybe SyncAdapter will be good for it? 回答1: You can use a TimerTask with scheduleAtFixedRate in a service class to achieve this, here is an example of Service class, you can use it public class

How to make Android BroadcastReceiver work with AlarmManager?

走远了吗. 提交于 2019-12-20 02:57:19
问题 I have the following code to post intents: alarmMgr = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent("myLog"); intent.putExtra("message", new Date().toString()); alarmIntent = PendingIntent.getBroadcast(this, 0, intent, 0); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); alarmMgr.setRepeating(AlarmManager.ELAPSED_REALTIME,System.currentTimeMillis()+1000,5000,alarmIntent); And the following receiver: public class

Android Alarm manager is repeating after 5 seconds and ignoring interval time

跟風遠走 提交于 2019-12-20 01:55:19
问题 I am working on a widget application where I have to perform some task in every one minute. So, I am using AlarmManager to achieve this. But no matter whatever I set the interval time, its being repeated in every 5 seconds. I am using AlarmManager like this: final AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.cancel(pendingIntent); long interval = 60000; alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(),

Allowing the phone to sleep while using RTC alarm on Android

痞子三分冷 提交于 2019-12-19 19:48:08
问题 I've been seeing some strange issues using the Alarm manager in Android, despite the fact that I'm using RTC (non Wakeup) the phone will reliably send the PendingIntents on the correct repeating intervals. Details of my test Device is not charging, just sitting on my nightstand while I slept My service woke up on its repeat interval (30 minutes, an extreme I know) EVERY TIME The service logged its activity in a file so I could read it in the morning Now from my understanding the phone should

Restarting killed (stopped by task-killers) services in android like Whatsapp

限于喜欢 提交于 2019-12-19 19:46:25
问题 I am working on a app locker which has some background services (to lock apps). I am using Xiaomi Redmi Note 4g for the development. The MIUI has an in-built task manager which can be used to kill running apps. When I kill apps with this, all services, broadcastreceivers and alarmmanagers are getting removed (as expected from a task manager). My requirement is to prevent my background services from getting cleared from task-killers, but if the user navigates to settings and force closes, the

PendingIntent get requestCode

你说的曾经没有我的故事 提交于 2019-12-19 16:54:54
问题 I use an AlarmManager to start a service. When i set up the AlarmManager i use the PendingIntent and use a unique requestCode which is equal to a id row in my database. PendingIntent pendingIntent = PendingIntent.getBroadcast(SettingsActivity.this, lecture.getId(), myIntent, 0); How can I retrieve that id in my service when it starts? I basically need only the requestCode parameter. I want to use that id to retrieve data from my database and show it in a notification. I have implemented all

Android notification app not working properly

醉酒当歌 提交于 2019-12-19 11:52:10
问题 I'm developing an android app, and part of it involves a notification that reminds the user to do something. This notification at a specified time and repeats every 12 hours. I'm using AlarmManager to schedule the alarm and I've also included the code to start my Alarm Service when the device boots. Here are my java classes: MainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super