[英]How to add live location tracking in Flutter even app is terminated?
I want to implement Google Map live location tracking to my application.我想在我的应用程序中实现 Google Map 实时位置跟踪。 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.我已经尝试过像 Workmanager 这样的软件包。 My application will work IOS and Android both.我的应用程序适用于 IOS 和 Android。 Do I have to write native code for both?我必须为两者编写本机代码吗? If so, I maybe can write for Android but I dont know IOS side.如果是这样,我也许可以为 Android 编写,但我不知道 IOS 方面。 How popular applications like Whatsapp or Snapchat do that? Whatsapp 或 Snapchat 等流行应用程序如何做到这一点? Is it possible to do this in Flutter?在 Flutter 中可以做到这一点吗?
You should have a look on the following package: https://pub.dev/packages/geolocator .您应该查看以下包: 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.据我所知,它甚至可以处理 Android 上的前台服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.