Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] xamarin.android – android – Alarm stops firing after some time

Posted on November 14, 2022

Solution 1 :

AlarmManager work perfectly when the App is running in Foreground or in Background.

But when the App is quit/force-stopped/killed , Alarm Manager is cancelled.

Alarm will go off again only the App is again launched by the user.

To keep alarm alive when app closed you might have to use Foreground service .

Here is a sample you could refer to .

Problem :

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 received.
8/2/2020 9:28 AM Reports alarm received.
8/2/2020 9:28 AM Reports alarm finished.
8/2/2020 10:28 AM Reports alarm received.
8/2/2020 10:28 AM Reports alarm finished.
8/2/2020 11:28 AM Reports alarm received.
8/2/2020 11:28 AM Reports alarm finished.
8/2/2020 12:30 PM Reports alarm received.
8/2/2020 12:30 PM Reports alarm finished.
8/2/2020 1:30 PM Reports alarm received.
8/2/2020 1:30 PM Reports alarm finished.
8/2/2020 2:30 PM Reports alarm received.
8/2/2020 2:30 PM Reports alarm finished.
8/3/2020 8:13 AM Initializing Alarm, next alarm will fire at 8/3/2020 5:13 AM

As you see between 2:30 PM to 8:13 AM the next day, no alarms were fired

This is the initialization:

alarmMgr.SetInexactRepeating(AlarmType.RtcWakeup, calendar.TimeInMillis, 1000 * 60 * 60, alarmIntent);

I have acquired the WAKE_LOCK permission.

Thanks in advance

Comments

Comment posted by Joseph. S

I’m not so sure that’s how AlarmManager works, because I see many apps which doesn’t use any services and still get to run code periodically, For fact: when my app is killed – it still works for a few hours then stops

READ  [ANSWERED] kotlin - Where is default animation present in android?
Powered by Inline Related Posts

Comment posted by stackoverflow.com/questions/30525784/…

Check

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress