简体   繁体   中英

Doze mode and foreground service

Checking my app's behavior on M Preview device, it seems that its foreground (with active notification) service playing music is not affected by Doze mode. But reading docs it seems that foreground services are exempt only from AppStandby.

What is the real rule?

In this post 's comments on Sep 17 Dianne Hackborn writes:

Apps that have been running foreground services (with the associated notification) are not restricted by doze.

So yes, your findings seem to be the intended behavior.

Attention, Foreground service can prevent your app never into app standby, but not doze.

Here use adb cmd to test

$ adb shell dumpsys battery unplug    
$ adb shell am set-inactive <packageName> true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM