alarmmanager

android - Alarm stops firing after some time

非 Y 不嫁゛ 提交于 2021-02-11 14:24:35
问题 I have an alarm that fires every hour and executes code in specific conditions It works smoothly, but when I leave my app unopened (the alarm initialization is on app startup) it stops after some time, these are the logs: 8/2/2020 6:27 AM Initializing Alarm, next alarm will fire at 8/2/2020 3:27 AM 8/2/2020 6:27 AM Application starting. 8/2/2020 6:28 AM Application stopped. 8/2/2020 6:28 AM Reports alarm received. 8/2/2020 7:28 AM Reports alarm received. 8/2/2020 8:28 AM Reports alarm

Sending Extras to onReceive only retrieves ALARM_COUNT

笑着哭i 提交于 2021-02-10 07:03:19
问题 I made a custom view that sets an alarm with AlarmManager. I want to restore this view later so I'm trying to send the BroadcastReceiver several extras. The onReceive fails to retrieve anything but the ALARM_COUNT extra though. I've looked for a while and count find a solution. I've tried PendingIntent.FLAG.UPDATE.CURRENT multiple flags with the intent itself but nothing works. Is there a better way to restore a views state from a BroadcastReceiver? 回答1: "extras are all serialized into a byte

Sending Extras to onReceive only retrieves ALARM_COUNT

感情迁移 提交于 2021-02-10 07:01:21
问题 I made a custom view that sets an alarm with AlarmManager. I want to restore this view later so I'm trying to send the BroadcastReceiver several extras. The onReceive fails to retrieve anything but the ALARM_COUNT extra though. I've looked for a while and count find a solution. I've tried PendingIntent.FLAG.UPDATE.CURRENT multiple flags with the intent itself but nothing works. Is there a better way to restore a views state from a BroadcastReceiver? 回答1: "extras are all serialized into a byte

My AlarmManager fires the alarm immediately

折月煮酒 提交于 2021-02-08 12:13:50
问题 Though this question is repeated over and over here on SO, but non of the solutions are working, in the code below it should fire for the first time after 10 seconds from launching my activity, but it launch immediately. And I'm using FLAG_UPDATE_CURRENT so there's no past time to fire immediately as I'm not setting it at specific hour/minute/sec. Could you please bring my attention to what I'm missing. I'm testing on Android 5.0 Targeting API 4.0+ compileSdkVersion 23 minSdkVersion 16

Repeat notification every day 12h

瘦欲@ 提交于 2021-02-08 05:38:37
问题 I want repeat my notification every day at 12h, but my code isn't working... I launch my Alarm Manager in MainActivity in OnCreate like this : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ma); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 12); calendar.set(Calendar.MINUTE, 00); calendar.set(Calendar.SECOND, 0); Intent intent1 = new Intent(MainActivity.this, AlarmReceiver.class);

Xamarin AlarmManager not firing when app sleeps

主宰稳场 提交于 2021-01-29 21:32:59
问题 I have following code to fire an alarm at exact time. When my app goes to sleep/background, Alarm does not FIRE , however as soon as I unlock my phone, then it fires right away. Intent i = new Intent(this, typeof(MyReceiver)); i.PutExtra("Speaker", txtSpeaker.Text); PendingIntent pi = PendingIntent.GetBroadcast(this, 0, i, 0); string _date = DateTime.Today.ToString("MM-dd-yyyy") ; string _time = tpick.Hour + ":" + tpick.Minute; DateTime scheduleAt = Convert.ToDateTime(_date).Add(TimeSpan

Xamarin AlarmManager not firing when app sleeps

穿精又带淫゛_ 提交于 2021-01-29 19:35:41
问题 I have following code to fire an alarm at exact time. When my app goes to sleep/background, Alarm does not FIRE , however as soon as I unlock my phone, then it fires right away. Intent i = new Intent(this, typeof(MyReceiver)); i.PutExtra("Speaker", txtSpeaker.Text); PendingIntent pi = PendingIntent.GetBroadcast(this, 0, i, 0); string _date = DateTime.Today.ToString("MM-dd-yyyy") ; string _time = tpick.Hour + ":" + tpick.Minute; DateTime scheduleAt = Convert.ToDateTime(_date).Add(TimeSpan

AlarmManager with Notification in Android does not show any notifications

早过忘川 提交于 2021-01-29 19:03:05
问题 I try to create daily notification for my application. In order to test the application I set the interval for the notifications to 15 minutes. Unfortunately, no notification is shown. Neither when the application is running nor when it is closed. I tried to inspire myself with these solutions: https://stackoverflow.com/questions/33055129/how-to-show-a-notification-everyday-at-a-certain-time-even-when-the-app-is-close https://developer.android.com/codelabs/android-training-alarm-manager#0

Local notification not triggering in Android 10

拈花ヽ惹草 提交于 2021-01-29 08:31:33
问题 I am working on xamarin.forms app and I am setting local notification using alarm manager. It is triggering fine on android version 8 and 9 but somehow it's not triggering in Android 10 . In android device logs for Android 10 , I got 07-22 15:00:06.612 Samsung SM-M205F Verbose 4185 SamsungAlarmManager Sending to uid : 10244 action=null alarm=Alarm{a757a70 type 0 when 1595410200000 com.MyApp.andr.connect} 07-22 15:00:06.613 Samsung SM-M205F Warning 4185 BroadcastQueue Unable to launch app com

Android set alarmManager to trigger daily

*爱你&永不变心* 提交于 2021-01-28 19:11:42
问题 In my app, I need to start a service at 2:00pm daily. Right now I wrote the code to trigger the alarm once, this code is ran every time I open the app: AlarmManager alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, DownloadReceiver.class); PendingIntent pIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmMgr.cancel(pIntent); Calendar cal= Calendar.getInstance(); cal.setTimeInMillis(System