alarmmanager

AlarmManager at specific date and time

浪子不回头ぞ 提交于 2019-12-04 12:59:51
I'd like to show a dialog at specific date and time (25/12/2012 at 12.00) and I am using this code. I set like 11 month (because 0 is gen) but the alarm does not start. What is my mistake? Calendar cal=Calendar.getInstance(); cal.set(Calendar.MONTH,11); cal.set(Calendar.YEAR,2012); cal.set(Calendar.DAY_OF_MONTH,25); cal.set(Calendar.HOUR_OF_DAY,12); cal.set(Calendar.MINUTE,00); cal.set(Calendar.SECOND,0); Intent _myIntent = new Intent(context, Notify.class); PendingIntent _myPendingIntent = PendingIntent.getBroadcast(context, 123, _myIntent, PendingIntent.FLAG_UPDATE_CURRENT| Intent.FILL_IN

Android: why did the Alarm notification stop after system reboot

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 12:54:42
问题 I am developing an android application that should fire an alarm five times a day: - the times in each day is not constant - after the alarm is fired I will schedule the next alarm. My problem is : the alarm notification works for 1 day then it stops and also when the device is rebooted twice the notification doesn't work , I don't now if there is another way to do that , any help will be very appreciated! Code: I have this function to call the broadcast reciever public static void Start

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

半世苍凉 提交于 2019-12-04 11:32:40
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 location and asks for any new data from server. IntentService send server response back to main service

Alarm Manager won't work when the app is killed in the background and device is locked

我怕爱的太早我们不能终老 提交于 2019-12-04 11:22:00
I have been stuck in this situation for a long time... I want to use the alarm manager to show notification at the specific time, and now it worked in the situation listed below: when the app runs in the background, notification will be shown at the correct time, and no matter the device is locked or not. after the app has been killed in the background, i will still get correct notification when device is not locked, but things turn wrong when the device is locked, i can't receive any notification. Here's the code AlarmReceiver.java, all the needed permission has been added into

different situations to use AlarmManager vs Handler Android

China☆狼群 提交于 2019-12-04 10:20:34
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. 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 the activity itself. You would use AlarmManager for periodic background operations, much like you would use

Alarm manager triggered immediately

匆匆过客 提交于 2019-12-04 09:10:38
问题 Hi I am currently working with AlarmManager. I have written a code given below. As per code the AlarmManager should be triggered after 10 Sec, but here in my code the alarm manager triggers immediately. Please help. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); int alarmType

setRepeating of AlarmManager not respond within the time indicated

你离开我真会死。 提交于 2019-12-04 06:30:05
问题 AlarmManager should be repeated every 1 minute, but repeated every 1, 2, 3 or 4 minutes. Since the application I throw AlarmManager public class PacienteApp extends Application { @Override public void onCreate() { AlarmManager gps = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(this, GpsReceiver.class); PendingIntent pending = PendingIntent.getBroadcast(this, 0, i, 0); gps.setRepeating(AlarmManager.RTC, System.currentTimeMillis(), 1000 * 60, pending); } }

How to update an app widget on midnight?

混江龙づ霸主 提交于 2019-12-04 05:38:54
My app has a widget that shows today's date and need to be updated on midnight. The widget is defined in the manifest as <manifest> ... <application> ... <receiver android:name=".MyWidgetProviderClass" android:label="MyLabel" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_icon_info" /> </receiver> </application> </manifest> And the widget info file is <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:initialLayout="

How to read Adb Dumpsys alarm output [duplicate]

给你一囗甜甜゛ 提交于 2019-12-04 05:13:17
问题 This question already has answers here : How to read “adb shell dumpsys alarm” output (3 answers) Closed 2 years ago . I'm setting multiple alarms on repeat through alarm manager, they are working fine on the day they got set but not repeating at all. I have updated my code but I can't wait all day to check if the code is even working or not so I have tried adb shell dumpsys alarm command but I don't know how to read the output properly and how to extract the times of alarms being set. I have

Android Developer - Alarm manager vs service

為{幸葍}努か 提交于 2019-12-04 05:07:22
I am making an app that needs to execute a function each hour even the app is closed. First of all, I thought to create a service, but during my tests, I realise that android sometimes kills my service. So I was looking for another solution and I found AlarmManager. I have implemented it and it seems to work but I have the doubt if it will happen the same the service or it will run forever? (Until reboot of the mobile...) Another question, it is necessary to create a new thread to execute the process in alarm manager or it runs directly in other thread? I have implemented it and it seems to