简体   繁体   中英

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.

After two months of searching I found a best code which works on Oreo and above devices when app is in foreground or background.

So I make a repository for all developer to take that code and use. Code link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM