Advertisement
selvalives

Untitled

Dec 11th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. ACCESS_FINE_LOCATION
  2.  
  3.  
  4. locationmanager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  5. locationmanager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0,googlemapactivity.this);
  6.  
  7.  
  8. @Override
  9. public void onLocationChanged(Location location)
  10. {
  11. tcurrentlocation.setText(location.getLatitude()+","+location.getLongitude());
  12. locationmanager.removeUpdates(this);
  13. LatLng currentlocation=new LatLng(location.getLatitude(),location.getLongitude());
  14. map.addMarker(new MarkerOptions().position(currentlocation).title("Current Location"));
  15. map.moveCamera(CameraUpdateFactory.newLatLng(currentlocation));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement