Fused Location Provider android- Google I/O 2013 - Beyond the Blue Dot: New Features in Android

  Android location services are automatically maintains the user current location. Recently google released through google I/O  “Fused Location Providers”. What is the meaning of fused location?
   Taking  Gps, wifi, Mobile network, Sensors  which provides the location and taking best location out of these, By fusing these will give the better location and follows the user position continuously.

 How to implement this api to the android application?
    Android providing google play services library, which will provide the all apis which are required for implementing fused location providers.
  Location providers sends the user current location to the application through LocationClient.
Declare the permissions in the manifest.xml file
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Class will implement     implements
                 GooglePlayServicesClient.OnConnectionFailedListener, LocationListener {

private LocationClient mLocationclient;

int resp = GooglePlayServicesUtil

              if (resp == ConnectionResult.SUCCESS) {
                     mLocationclient = new LocationClient(getActivity(), this, this);
              } else {
                     GooglePlayServicesUtil.getErrorDialog(resp, getActivity(), 2);

       public void onConnected(Bundle arg0) {
              Log.i("location", "onConnected");

              if (mLocationclient != null && mLocationclient.isConnected()) {
                     Location loc = mLocationclient.getLastLocation();
                     if (loc != null) {
                     String locLatitude = "" + loc.getLatitude();
                     String locLongitude = "" + loc.getLongitude();

else {
       LocationManager manager = (LocationManager) getActivity()

                           if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {



       public void onDisconnected() {
              Log.i("location", "onDisconnected");


       public void onConnectionFailed(ConnectionResult result) {
              Log.i("location", "onConnectionFailed");


       public void onLocationChanged(Location location) {
              if (location != null) {
              String locationLatitude = "" + location.getLatitude();
              String locLongitude = "" + location.getLongitude();




Popular posts from this blog

What is Android ?