简体   繁体   English

Android-GPS +加速度计-两分钟之间的距离

[英]Android - GPS + Accelerometer - Distance between two moments

Are there some high level api like this on Android world? Android世界上是否有一些像这样的高级api?

DistanceCalculator dc = new DistanceCalculator();
dc.start();
//some walking, driving, whatever
float distanceInMeters = dc.stop();

I'm looking for something that mix the things up (gps, accelerometer, etc) to fix errors and compensate bad accuracy, etc. For example, if i drive arround the square quickly starting and ending to same point, and there wasn't enough time to get new coodinates. 我正在寻找可以将各种东西混合在一起的东西(gps,加速度计等),以修复错误并补偿不良的准确性等。例如,如果我开车快速绕过正方形并开始到同一点,并且没有有足够的时间获得新的同伴。 Am i lost? 我迷路了吗?

Thank you everybody! 谢谢大家!

Well you need to follow below steps, 1. Register location listener. 那么您需要按照以下步骤操作:1.注册位置侦听器。 2. Cache the last known location (you need to put smart filter on accuracy level). 2.缓存最后一个已知的位置(您需要将智能过滤器置于准确性级别)。 3. Calculate the distance between simple Android API method distanceTo 3.计算简单的Android API方法distanceTo之间的距离

or else you can write you own mechanism for distance calculation between to lat/long. 否则,您可以编写自己的机制来计算经纬度之间的距离。

One thing is clear that, there is not direct API or method which you give you distance. 一件事很清楚,没有直接的API或方法给您带来距离。

For example, if i drive arround the square quickly starting and ending to same point, and there wasn't enough time to get new coordinates. 例如,如果我绕着正方形快速地开始和结束到同一点,并且没有足够的时间来获取新的坐标。 Am i lost? 我迷路了吗?

If you are moving, wou get every second a GPS fix, that is sufficient for distance measurement. 如果您正在移动,您将每秒获得一次GPS定位,这足以进行距离测量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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