开发者

Android : How may ways I can get current location programatically

How many way开发者_如何学运维s I can get the current geo location (lat,lang) programatically in Android, Which is the best, accurate and faster way??

Look forward to your suggestions

Thanks


You should read Obtaining User Location in the SDK's documentation.


It is possible to find out location via IP address:

http://www.google.com.sg/search?aq=1&oq=identifying+location&sourceid=chrome&ie=UTF-8&q=identifying+location+of+ip+addresses

Another method is by GSM, or control-plane locating, yet other methods can be found here:

http://en.wikipedia.org/wiki/Location-based_service#Others


When developing a location-aware application for Android, you can utilize GPS and Android's Network Location Provider to acquire the user location. Although GPS is most accurate, it only works outdoors, it quickly consumes battery power, and doesn't return the location as quickly as users want. Android's Network Location Provider determines user location using cell tower and Wi-Fi signals, providing location information in a way that works indoors and outdoors, responds faster, and uses less battery power. To obtain the user location in your application, you can use both GPS and the Network Location Provider, or just one`

locationManager.requestLocationUpdates(
                                LocationManager.GPS_PROVIDER,
                                MIN_TIME_BW_UPDATES,
                                MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                        Log.d("GPS Enabled", "GPS Enabled");
                        if (locationManager != null) {
                            loc = locationManager
                                    .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                          }
locationManager.requestLocationUpdates(
                            LocationManager.NETWORK_PROVIDER,
                            MIN_TIME_BW_UPDATES,
                            MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                    Log.d("Network", "Network");
                    if (locationManager != null) {
                        loc = locationManager
                                .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

                    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜