alarmmanager

AlarmManager to fire notification at every 24 hours

廉价感情. 提交于 2019-12-08 01:50:45
问题 I am using AlarmManager() to fire Notification. I am setting it to fire at 10:30 AM of the morning and repeat at every 24 hours. My code is as follow. I have tested yesterday and the problem is that It was repeated around 4-5 times in just next 2 hours. I am not understanding that what is the problem. I want to fire it only at 10:30 AM of the morning and repeat at only 24 hours. Please help me solve the problem. I am calling this code on my app's Splash screen onCreate() My Code : Intent

Alternatives for AlarmManager setRepeating in API 19 and above?

℡╲_俬逩灬. 提交于 2019-12-08 01:01:56
问题 My app requires very accurate timing of a repeating alarm. Since API 19 the AlarmManager setRepeating is now inexact to save battery ( Save the trees and all ). Is there any workaround to get API 19's setExact method to work on a loop? Note: as of API 19, all repeating alarms are inexact. If your application needs precise delivery times then it must use one-time exact alarms, rescheduling each time as described above. Legacy applications whose targetSdkVersion is earlier than API 19 will

Service and IntentService, Which is better to run a service that poll database value from the server?

放肆的年华 提交于 2019-12-07 23:50:56
问题 I had read quite a number of resources regarding the Service and IntentService . However when come to make a decision, I am not confident enough to choose which type to use in order to create a background service that will poll data from database in a time interval and stop it when I get the data I want since the data represent a status of a request, eg. ordering medicine confirmation status(pending, completed, in progress). I need to detect when a status is set to "completed" and send a

AlarmManager is not working after app is closed? - Android

↘锁芯ラ 提交于 2019-12-07 23:44:33
问题 I have a small problem about alarmmanager but I couldn't find a answer which fits to my code. My question is simple. I have a list of alarms which is set to future. While my app is running, I can recieve Notification. But when I close my app, It doesn't send notification to me and if I run my app again, past notifications can be seen in notification center. Here is my codes. In MainActivity.java I use this method which can take a Person List and sets alarm of each of Person. I run this method

How to repeat an action every day in an Android app?

冷暖自知 提交于 2019-12-07 21:37:34
问题 I want to repeat an action every day; it must continue working even if the app is not running or the device has been restarted (rebooted). In my code I'm trying to show a TOAST message every 1 minute (as a test); it's working fine in the emulator but on a real device it doesn't work( i tried to do some changes to fixed as i see in some answers but still the same thing) MyReceiver class MyReceiver : BroadcastReceiver() { private val channelId = "com.medanis.hikamwahimam" override fun onReceive

Android How to stop AlarmManager in other Activity

我的未来我决定 提交于 2019-12-07 15:03:40
问题 I am using a service which is called in Activity 'A' repeatedly created by AlarmManager. My service is checking repeatedly response from server, when response is true new Activity B is started. Now when activity B is started i want to stop service as well as AlarmManager. how can i do this?? my 'A' activity code for calling service is following Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, 40); Intent intent = new Intent(this, response.class); // Add extras to the bundle

Start activity when screen is off

♀尐吖头ヾ 提交于 2019-12-07 10:14:08
问题 I have set up an AlarmManager to start up an activity. This activity also plays a sound, similar to an alarm app or an incoming call. It works ok if the screen is on, even if the screen is locked. If the screen is off, it doesn't work at all. I tried using the following as the first thing in onCreate getWindow().setFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); If the screenlock is not enabled, this turns on the screen and I can see my

AlarmManager never calling onReceive in AlarmReceiver/BroadcastReceiver

瘦欲@ 提交于 2019-12-07 08:14:11
问题 I still cannot get my AlarmReceiver class' onReceive method to fire. Does anything stick out as wrong with this implementation? All this is supposed to do is wait a certain period of time (preferably 6 days) and then pop up a notification. (Can you believe there isn't a built in system for this? crontab anyone!?) MyActivity and BootReceiver both set up an alarm under the necessary conditions. AlarmService kicks out a notification. And AlarmReceiver is supposed to catch the alarm and kick off

Alarm manager not triggering alarms at exact time in android

人盡茶涼 提交于 2019-12-07 07:40:07
问题 I scheduled alarm using Calendar class as below Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY,1); cal.getTimeInMillis(); cal.set(Calendar.MINUTE,05); long TriggerMillis = cal.getTimeInMillis(); AlarmManager aManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); aManager.set(AlarmManager.RTC_WAKEUP, TriggerMillis,pIntent); where pIntent is an pending intent to proceed further when alarm triggers. The event triggers with few seconds delay. Is that any

Alarm Manager not working at specific given time interval

雨燕双飞 提交于 2019-12-07 06:49:17
问题 Hi I am using alarm Manager for specific time interval for 3 minutes and I started monitoring. It worked for sometimes and suddenly I noticed there is irregular time interval which is not correct! You can see in attached log where at "20-Jul-2016 12:22:03 pm" time varies! I connected the phone and turned off the screen and monitored! where for every 3 minutes, i hit the server and gets the response as 1. But at one time, it takes 5 minutes to hit the server! Why this strange issue happened?