I want to make some external service monitor and be notified on problems as fast as possible.
I tried to set up AlarmManager
with 1-2 minutes interval, but it looks like it fires randomly every several minutes.
Of course, I want to be safe from killing my background task by android, which would stop monitoring if I just use Service
.
Is it possible to use AlarmManager
in small, accurate intervals?
Which approaches are used in applications like Facebook, Gmail to notify about new messages?
Would it be better to make Service
with startForeground
and partial WakeLock
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…