Should I use AlarmManager or Handler?

前端 未结 4 1851
我在风中等你
我在风中等你 2020-12-14 20:27

I\'m writing an app that constantly polls the device\'s sensors and every so often should write down some statistics to a file. This could be as fast as once a second or as

4条回答
  •  太阳男子
    2020-12-14 21:04

    If the app should work in standby then AlarmManager. If not then Handler.
    AlarmManager will wake CPU therefore it will drain battery more, while Handler will not work on standby.

提交回复
热议问题