Android 在后台收集用户位置的 IntentService

IntentService to collect users location in the background on Android

我的 android 应用程序有位置权限,我想做的是创建一个服务(可能是意图服务),每次其他应用程序使用 GPS 时都会在后台启动并将当前位置收集到我的应用程序 sqlite 数据库(直到用户决定关闭 GPS 或存在使用 GPS 的应用程序)

这可能吗?如果可能的话:

1) 这个意图服务会是什么样子? 2) 如何在我的 appmanifest 中配置它?

Is that even possible?

不直接。你无法知道 "other app uses the GPS".

欢迎您从 the PASSIVE_PROVIDER 注册位置更新,这可能符合您的需要。