开发者

Determining if user is driving using gps

Is there a way in Andro开发者_JAVA百科id 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.

Any help would be appreciated.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜