scheduling alarm for every second in android 5.1

后端 未结 7 2237
醉梦人生
醉梦人生 2020-12-05 20:04


I want to run alarm service for every second in my application.It is working fine below 5.1 version. but it is not triggering in 5.1 devices. I am using commonsware wa

7条回答
  •  囚心锁ツ
    2020-12-05 20:43

    Try These Steps.

    1. Use a Alarmmaager periodical after 1 min
    2. Inside that alarm manager use a handler that call after some seconds and perform your task.

    Remember

    Its not a Good Idea, As the alarm manager is not aware of the current situation of the device, e.g., it does not consider if the device is connected to a power plug, idle or connected to a network Also the alarm manager waste of resources because its doesn't care about when the device has more resources available.

提交回复
热议问题