位置应用程序在 Android O 中如何工作?

How will location apps work in Android O?

现在很多应用程序都会跟踪您的位置。但是,在 Android Oreo 中,如 this Android Developers video.

中所述,“应用程序将无法在后台自由 运行”

根据the developer docs

Apps can receive location updates only a few times each hour.

对于该规则的任何例外情况:

Consider whether your app's use cases for running in the background cannot succeed at all if your app receives infrequent location updates. If this is the case, you can retrieve location updates more frequently by performing one of the following actions:

...

Start a foreground service in your app by calling startForegroundService(). When such a foreground service is active, it appears as an ongoing notification in the notification area.

这似乎是在说,如果您是 Oreo 上位置跟踪的用户,那么您会一直被另一条持续通知所困。这是正确的吗?

我真的希望有办法解决这个问题,因为如果我有三个跟踪位置的应用程序,即使我没有移动,我的通知栏也会被三个正在进行的通知弄得乱七八糟。

What this seems to be saying is, if you want to be able to detect location changes in Oreo, your app requires an ongoing notification at all times. Is this correct?

不完全是。这就是说,如果应用程序希望接收位置更新的频率高于每小时几次,而不是前台 activity,则很可能需要创建前台服务。如文档所示,还有其他选择(被动提供程序、地理围栏、批处理 API)。并且一些应用程序不需要特别频繁地更新位置,因为底层数据不会特别频繁地更改(例如,天气应用程序小部件)。

if I have three apps that track location, my notification bar is going to be cluttered with three ongoing notifications even when I'm not moving

恕我直言,如果你有 1+ 个应用程序在后台持续跟踪你的位置,你真的需要重新考虑你的生活选择。