Foreground service not receiving location updates in Android 7.0+ when screen is off

前端 未结 5 1526
面向向阳花
面向向阳花 2021-02-04 03:29

I am trying to create an Android application that continuously logs device location data in realtime while the device screen is off. My code works correctly with Android 6.0 and

5条回答
  •  生来不讨喜
    2021-02-04 03:41

    I had been experiencing this issue on emulated devices running 7.0 and 8.0 and consistently the location callback was not being triggered when the screen was off (cmd+P). I was finally able to get my hands on a real 7.0 device (Galaxy S7) and I was not able to replicate the issue. Sorry if I wasted anyone's time, apparently it is an emulator issue.

提交回复
热议问题