Android: How to use AlarmManager

前端 未结 6 1071
时光取名叫无心
时光取名叫无心 2020-11-22 06:40

I need to trigger a block of code after 20 minutes from the AlarmManager being set.

Can someone show me sample code on how to use an AlarmManager<

6条回答
  •  余生分开走
    2020-11-22 07:18

    I wanted to comment but <50 rep, so here goes. Friendly reminder that if you're running on 5.1 or above and you use an interval of less than a minute, this happens:

    Suspiciously short interval 5000 millis; expanding to 60 seconds
    

    See here.

提交回复
热议问题