Created
February 20, 2015 14:55
-
-
Save pratamawijaya/50e59ea65f123302854e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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