简体   繁体   English

使用Android进行位置跟踪

[英]Location Tracking with Android

I've been using really ugly and old GPS tracking in my app and decided to upgrade it. 我在应用中一直使用非常丑陋的旧GPS跟踪,因此决定对其进行升级。 I've came into this class & interface: http://gabesechansoftware.com/location-tracking/ 我进入了此类和界面: http : //gabesechansoftware.com/location-tracking/

but I have no idea how to implement it. 但我不知道如何实施。

I'm trying to get the user Latitude and Longitude in one of my application tabs, this way: 我正在尝试通过以下方式在我的一个应用程序标签中获取用户的纬度和经度:

GPSTracker myGPS = new GPSTracker(getActivity());
        Toast.makeText(getActivity(),"Lat:" + myGPS.getLatitude(),Toast.LENGTH_LONG).show();

The output is 0.0 . 输出为0.0 Is there any way to know when the user GPS records have finally tracked? 有什么方法可以知道用户GPS记录何时终于被追踪?

The canonical way to get location is to use the google play location services which are available in API8 (2.2, Froyo) and above. 获取位置的规范方法是使用Google Play位置服务 ,该服务在API8(2.2,Froyo)及更高版本中可用。 With this library you can subscribe to location updates based on criteria such as distance moved, a set update frequency, and combinations. 使用此库,您可以基于移动距离,设置更新频率和组合等条件来订阅位置更新。

There are more details available in the " Receiving Location Updates " training topic. 接收位置更新 ”培训主题中提供了更多详细信息。

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

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