前景服务Android 11和12的问题

发布于 2025-02-08 11:49:47 字数 259 浏览 4 评论 0原文

任何人都知道如何每秒获得每秒钟的位置更新。当我的设备处于前景或背景模式时。 当他在路上醒来或旅行时,我正在进行跟踪应用程序的位置。

实际上,我在第10版上工作的应用程序不从事Android 11和12的工作。 还在Google上进行了搜索,找不到确切的答案。

我使用此权限:

  1. 访问背景权限,
  2. 访问粗略许可。
  3. 访问位置良好。 或前景服务以通知,

如果有人知道,请告诉我

谢谢

Any one know how get the location update every seconds. when my device on foreground or background mode.
I am working on Tracking app get the location in every seconds when he is waking on road or traveling whatever.

Actually my app working on version 10 not working on android 11 and 12.
Also searched on google don't found exact answer.

I used this permission:

  1. Access background permission,
  2. Access Coarse permission.
  3. Access Fine Location.
    OR Foreground services for notification

If any one know please let tell me

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

〆一缕阳光ご 2025-02-15 11:49:47

在Android 11或更高版本中,用户必须访问App权限,并特别允许他们在后台任职。不能从应用程序请求此权限。仅来自电话配置。

in android 11 or higher the user has to go to app permissions and specifically give them permissions to always take the position in the background. This permission cannot be requested from the app. Only from the phone configuration.

歌枕肩 2025-02-15 11:49:47

为了帮助保护用户隐私,Android 11(API级别30)引入了限制前景服务何时可以访问设备的位置,相机或麦克风。当您的应用在应用程序在后台运行时启动前景服务时,前景服务具有以下限制:

除非用户授予Access_background_location授予您应用程序的访问权限,否则前景服务将无法访问位置。
前景服务无法访问麦克风或相机。

参考链接: https:// https://developer.android.com/guide.com/guide/guide/guide/guide/components /前景服务#访问限制

To help protect user privacy, Android 11 (API level 30) introduces limitations to when a foreground service can access the device's location, camera, or microphone. When your app starts a foreground service while the app is running in the background, the foreground service has the following limitations:

Unless the user has granted the ACCESS_BACKGROUND_LOCATION permission to your app, the foreground service cannot access location.
The foreground service cannot access the microphone or camera.

Reference link : https://developer.android.com/guide/components/foreground-services#access-restrictions

爱人如己 2025-02-15 11:49:47

您必须将前景服务用于此服务,并在前景服务中添加任务,以使用地理位置或任何其他库来获取位置。

实施的步骤:

  1. 使用链接库实现前景服务:: [1]: https:// github。 com/raja0sama/rn-foreground-Service
  2. 使用地理位置添加无头任务。
  3. 从最近将应用程序删除后,您将获得位置。

you have to use the Foreground service for that and add a task in the Foreground service to get a location using geolocation or any other library.

steps to implement:

  1. implement foreground service using link library::[1]: https://github.com/Raja0sama/rn-foreground-service.
  2. add headless task using geolocation.
  3. you will get the location after the app is removed from recent.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文