Background process timer on android

前端 未结 2 672
星月不相逢
星月不相逢 2021-01-03 06:19

I\'m trying to get a process timer to run and keep it running in the background on android (starts with a button click).

The timer must be on 30 seconds and should e

2条回答
  •  再見小時候
    2021-01-03 07:00

    Oh god, don't ever use AlarmManager for 30s timers. It's kind of an overkill and also put a significant drain on device resources (battery, CPU...).

    Perhaps you could try using a real background Service instead of IntentService as IntentService tends to shut itself down when it runs out of work. Not sure if this is the case here, but it's worth a try.

提交回复
热议问题