[英]A best code for getting location when app is in background and foreground for Pie devices
I know here is a good example of background services to get location. 我知道这是后台服务获取位置的一个很好的例子。 But in that code I am unable to understand that which one service is best of getting location and how to get location on another activity from service.
但是在该代码中,我无法理解哪个服务最适合获取位置以及如何从服务获取另一个活动的位置。 I also know i have to call start service in another activity and i have to write broadcast function for getting location periodically.
我也知道我必须在另一项活动中致电启动服务,并且必须编写广播功能以定期获取位置。
Now my main problem is I only know all of that what I have to do but here I am unable how to do . 现在我的主要问题是我只知道我必须做的所有事情,但是在这里我无法做。
I want a specific code help where I have a service for location and get that location on another activity when app is in background or foreground with less battery drag for Pie Devices. 我需要特定的代码帮助,在其中我可以提供位置服务,并且当应用程序在后台或前景中运行时,在其他活动中获得该位置,而对Pie Devices的电池拖动较少。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.