alarmmanager

AlarmManager object after turning off and on the phone

此生再无相见时 提交于 2019-12-22 05:25:15
问题 In my app, I set an alarm AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); ... PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT); ... alarmMgr.set(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(), pendingIntent); It works fine unless I turn off and turn on the phone. To be more specific, let's say at 10:20, I set an alarm to 10:22 and I turn off and turn on the phone at 10:21, alarm won't work.

Just how inexact is setInexactRepeating() for AlarmManager?

旧街凉风 提交于 2019-12-22 04:36:08
问题 I know this question has been asked before, here, but the answer given refers to documentation which is actually incredibly ambiguous. It says the inexact alarm might occur almost a "full interval" after the specified time. For alarms with an interval of a whole day, this would seem excessive. The documentation does say here (under "RTC examples") that you can use inexact repeating for daily alarms, and gives an example of an inexact alarm being set for "approximately 2pm". Nobody in their

setAlarmClock not exact in android marshmallow

≡放荡痞女 提交于 2019-12-22 00:05:58
问题 I use setAlarmClock method of Alarmmanager for do alarm clock application. When I set alarm clock from 6.00 AM and alarm in 6.01 AM . It delay and not exact. Code when setAlarmClock . Intent intent = new Intent(getBaseContext(), AlarmReceiver.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.putExtra(AppConstant.REMINDER, note.convertToString()); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), note.getId(), intent, PendingIntent.FLAG_CANCEL

AlarmManager & onStartCommand

五迷三道 提交于 2019-12-21 23:53:28
问题 I develop a GPS Tracking app on android. I use AlarmManager to wake up the device every 5 minutes. I developed a log file that shows that the application works great until a moment when I receieve public int onStartCommand(Intent intent, int flags, int startId) with startId = 1 again .... in this case I noticed that all variables are reset so I initialize all variables again .. the issue is that once this happens I keep getting same event with startID = 1 again and after few calls the app

Android AlarmManager: how to avoid to going off of past alarms

一个人想着一个人 提交于 2019-12-21 19:44:57
问题 Hi and thank you for your help. I have an application that uses AlarmManager to set one alarm a day for the next weeks, months... I set one alarm for each day of the week to start the Activity and one alarm for each day of the week for stopping the Activity after some time I have the following problem that I will try to explain in the following lines: Today is Wednesday, I open the application and set my alarms for MON, TUE, WED, THU, FRI, SAT, SUN... as soon as I set the alarms: ALL the

Android: Send location data in background periodically (every 30 seconds) and ask server for new data

你说的曾经没有我的故事 提交于 2019-12-21 17:32:00
问题 Scenario: Post to server to get any new data in background every 30 seconds for long period i.e. 12 hours. Location data needs to be sent along with this. Current Implementation; Service Class; Location listener with interval of 30 seconds which sets the longitude & latitude values to two local variables Alarm manager fires pending Intent every 30 seconds to a broadcast receiver. Broadcast receiver starts an IntentService with location variables in the extras. The IntentService http posts

How to programmatically detect SONY - Stamina device energy profile is ON

試著忘記壹切 提交于 2019-12-21 09:14:21
问题 I want to notify user that my app will not work properly if he has SONY android phone with STAMINE energy profile ON. This profile is blocking AlarmManager and device is not waked up when I want. 回答1: Currently, there is no official way to detect if the STAMINA energy profile is selected. However, if there is enough community demand we may be able to open this up. 回答2: You could check it via Settings.Secure.getInt(contentResolver, "somc.stamina_mode", 0) == 1 Works at least on the Sony Xperia

detect default alarm clock application alarms

≯℡__Kan透↙ 提交于 2019-12-21 08:17:08
问题 I would like to know if there is a way (probably a system broadcast) to know that the alarm clock default application is now start ringing. if not - I'll be satisfied also if I could get progrematically list of all active alarms been set by the user(which I could extract from each alarm the exact time it would ring..) what I tried so far: I know there is a way to get formatted string to next alarm: String nextAlarm = Settings.System.getString(context.getContentResolver(), Settings.System.NEXT

AlarmManager is not triggered when App is closed

南笙酒味 提交于 2019-12-21 06:29:17
问题 I have some in-App notification to show to users at a specific time but nothing is shown when the App is closed. Setting alarm: Intent alarmIntent = new Intent(mMotherActivity, ReminderAlarmManager.class); if (ReminderNotificationType.CHANGE_LENS.equals(notificationType)) { alarmIntent.putExtra("NOTIFICATION_TYPE", "REMINDER"); } else { alarmIntent.putExtra("NOTIFICATION_TYPE", "ORDER"); } long scTime = alarmDate.getTime(); PendingIntent pendingIntent = PendingIntent.getBroadcast

AlarmManager is not triggered when App is closed

谁说胖子不能爱 提交于 2019-12-21 06:29:08
问题 I have some in-App notification to show to users at a specific time but nothing is shown when the App is closed. Setting alarm: Intent alarmIntent = new Intent(mMotherActivity, ReminderAlarmManager.class); if (ReminderNotificationType.CHANGE_LENS.equals(notificationType)) { alarmIntent.putExtra("NOTIFICATION_TYPE", "REMINDER"); } else { alarmIntent.putExtra("NOTIFICATION_TYPE", "ORDER"); } long scTime = alarmDate.getTime(); PendingIntent pendingIntent = PendingIntent.getBroadcast