如果确定用户在使用GPS行车 [英] Determining if user is driving using gps

查看:175
本文介绍了如果确定用户在使用GPS行车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有Android中的方式以某种方式使用GPS来确定用户正在驾驶(例如,如果用户正在移动的速度,然后说,10个英里)?什么是更好的是,如果有意向,每当用户移动快再用10英里每小时下10英里每小时,我可以接受,但我觉得我推着我的运气的那一个。

Is there a way in Android to somehow use the GPS to determine if the user is driving (e.g. if the user is moving faster then say, 10 mph)? What would be even better is if there was an intent I could receive whenever the user is moving faster then 10 mph or under 10 mph, but I think I'm pushing my luck with that one.

任何帮助将是AP preciated。

Any help would be appreciated.

推荐答案

您可能要设置一些的AsyncTask(后台线程)与你的preference的回调函数,将被称为当车速超过10英里每小时。您可以使用 Location.GetSpeed​​()函数

You probably want to set up some AsyncTask (background thread) with a call back function of your preference, which will be called when the speed is over 10 MPH. You can use the Location.GetSpeed() function.

此外,您可能想利用它返回米/秒的事实音符。但是,这是一个简单的转换。

Also, you might want to take note of the fact that it returns in meters/second. But this is a trivial conversion.

这篇关于如果确定用户在使用GPS行车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆