Location currentLocation= LocationServices.FusedLocationApi.getLastLocation(mLocationclient);
private GoogleApiClient mLocationclient; mLocationclient=new GoogleApiClient.Builder(this) .addApi(LocationServices.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); mLocationclient.connect(); Location currentLocation= LocationServices.FusedLocationApi.getLastLocation(mLocationclient); if(currentLocation==null) Toast.makeText(this,"could not connect",Toast.LENGTH_SHORT).show(); else { LatLng ll=new LatLng( currentLocation.getLatitude(), currentLocation.getLongitude() ); CameraUpdate update=CameraUpdateFactory.newLatLngZoom(ll,50); mMap.animateCamera(update); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)