Skip to content

Instantly share code, notes, and snippets.

@pratamawijaya
Created February 20, 2015 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratamawijaya/50e59ea65f123302854e to your computer and use it in GitHub Desktop.
Save pratamawijaya/50e59ea65f123302854e to your computer and use it in GitHub Desktop.
@Override
public void onConnected(Bundle bundle) {
if (location == null) {
// get last location device
location = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
if (mMap != null) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13));
mMap.addMarker(new MarkerOptions()
.position(new LatLng(location.getLatitude(), location.getLongitude()))
.title("Starting Point")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker))
);
lat = location.getLatitude();
lng = location.getLongitude();
Toast.makeText(this, "Lokasi kamu saat ini, sebagai patokan titik awal perjalanan kamu kak :')", Toast.LENGTH_LONG).show();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment