简体   繁体   English

即使应用程序终止,如何在 Flutter 中添加实时位置跟踪?

[英]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.

相关问题 即使使用 carp_background_location 终止应用程序,也将最新位置发送到 Firestore - send latest location to the Firestore even when the app is terminated using carp_background_location 我怎样才能知道Firefox即使在后台也正在跟踪我的位置 - How can I tell that Firefox is tracking my location even in the background Android即使在应用程序终止时也如何保存editText的值 - Android How to save the value of editText even when the app is terminated 即使应用程序终止,如何在 Android 中检测来电 - How to detect incoming calls in Android even when the app is terminated 如何停止追踪位置? - How to stop tracking location? 如果用户在跟踪应用中关闭位置服务,如何实时检查 - How to check in realtime if Location services switched off by user in a tracking app Android应用中的路线API实时跟踪 - Directions API Live tracking in android app 应用程序终止时的 FCM 推送通知 FLUTTER - FCM push notifications FLUTTER when app is terminated 在地图上的实时位置实时跟踪多个用户 - Tracking multiple users in real time on a live location on the map 创建即使在应用终止后仍可运行的Android应用服务 - Create a Android App Service which run even after app is terminated
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM