Мне нужно знать свое местоположение и чтобы не наносить свои координаты в код, а с помощью GPS.
public class MainActivity extends AppCompatActivity {
private final LatLng LOCATION_BURNABY = new LatLng(49.27645, -122.917587);
private final LatLng LOCATION_SURREY = new LatLng(49.187500, -122.849000);
private LocationManager locationManager;
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.addMarker(new MarkerOptions().position(LOCATION_SURREY));
}
public void City(View view) {
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
CameraUpdate update = CameraUpdateFactory.newLatLng(LOCATION_BURNABY);
map.animateCamera(update);
}