简体   繁体   中英

How to add live location tracking in Flutter even app is terminated?

I want to implement Google Map live location tracking to my application. For example I have two users, one is a carrier and one is a customer. When customer want to see where is my cargo, my application will show carrier's location to customer even carrier's application closed. How can I make this logic? I already tried packages like Workmanager. My application will work IOS and Android both. Do I have to write native code for both? If so, I maybe can write for Android but I dont know IOS side. How popular applications like Whatsapp or Snapchat do that? Is it possible to do this in Flutter?

You should have a look on the following package: https://pub.dev/packages/geolocator . It implemented your use-case by allowing background fetching of the position. It even handles the Foreground service on Android as far as I know.

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