在最新版本Android 11和12上不断运行背景服务
我搜索了很多谷歌搜索,并在过度堆栈流量上进行搜索,在移动模式下移动时,我没有得到任何适当的解决方案。
我还使用了工作经理周期性 请求,但其最小间隔为15分钟,然后如何获得位置。
我正在研究React Native Tracking项目,我创建了一个用于运行服务的本机模块。但是我的服务在背景模式下进行了一段时间。但是在从事近景服务的过程中。
如果任何人在移动版本11和12上使用背景位置更新。
谢谢
I googled a lot and search also on a over stack flow i did not get any proper solution for Continously location update when mobile on background mode.
I have also use workmanager Periodic
request but its Minimum interval is 15 minute then how get the location get sceconds.
I am working on react native tracking project i have create a native module for run services. but my service killed after sometime in background mode. but in working on forground service .
If any one use background location updates on mobile version 11 and 12 .Let me know and also share github link or code.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只能使用前景服务进行连续的背景位置。背景服务不是为此。请参阅有关如何创建和使用前景服务的链接: https:// https://developer.android.android.android.android .com/指南/组件/前景服务
You can only take continuous background location using Foreground service. Background service are not meant for this. Refer this link on how to create and use a foreground service: https://developer.android.com/guide/components/foreground-services
检查此反应库无需创建自定义的本机模块,请检查: reaction-norefort-地理位置服务
为什么要使用此库
用法:
edit :
您可以使用 watch置
);
上面的代码具有
Interval
watchPosition
的参数设置为1秒,因此它将获得更新活动的位置更新(仅Android)请记住要停止所有这些观察者。
Check this React-native library no need to create custom native modules , check : react-native-geolocation-service
Why should you use this library
Usage:
Edit:
you could use watchPosition
);
above code has
interval
param of thewatchPosition
is set to 1 sec so it will get update active location updates (android only)remember to stop all these observers.