使用 Location API Android 时,服务有什么用?

What is the use of a service when using the Location API Android?

我设法根据 Android Developers website 中可用的文档获取了位置对象(使用 Google Play 服务提供的位置 API)。尽管我已按照文档指示指定了服务,但我从不绑定它/启动它/在任何地方使用它。我做错了什么?

不,你没有做错任何事。这是 Android 10(API 级别 29)设备的要求。

Google Docs所说

When a foreground service is running, the system raises user awareness by showing a persistent notification. Your app retains access when it's placed in the background, such as when the user presses the Home button on their device or turns their device's display off.

所以基本上,如果您使用位置,它只会向用户显示通知,如果他们有 android 10 即 API 级别 29