<ru.yandex.yandexmapkit.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="you are key" />
final MapView mMapView = (MapView) findViewById(R.id.map); // MapController MapController mMapController = mMapView.getMapController(); // mMapController.setPositionAnimationTo(new GeoPoint(60.113337, 55.151317)); mMapController.setZoomCurrent(15);
C:\Documents and Settings\<user>\.android\debug.keystore
cd C:\Program Files\Java\jre6\bin
keytool -list -alias androiddebugkey -keystore <___>.keystore -storepass android -keypass android
package com.fewpeople.geoplanner; import android.os.Bundle; import com.google.android.maps.MapActivity; public class GeoMapActivity extends MapActivity { @Override public void onCreate(Bundle savedInstanceData) { super.onCreate(savedInstanceData); setContentView(R.layout.geomap); } @Override protected boolean isRouteDisplayed() { return false; } }
<application></application>
insert: <uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />
final MapView mMapView = (MapView) findViewById(R.id.mapview); // MapController MapController mMapController = mMapView.getController(); // mMapController.animateTo(new GeoPoint(60.113337, 55.151317)); mMapController.setZoom(15);
final MapView cMapView = (MapView) findViewById(R.id.map); // MapController MapController cMapController = cMapView.getMapController(); // , cMapView.setBuiltInZoomControls(true); // "" final LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); final LocationListener locationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) {} @Override public void onProviderEnabled(String provider) {} @Override public void onProviderDisabled(String provider) {} @Override public void onLocationChanged(Location location) {} }; locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); // overlay cMyLocationOverlay = new MyLocationOverlay(this, cMapView); cMyLocationOverlay.disableCompass(); cMyLocationOverlay.enableMyLocation(); cMapView.getOverlays().add(cMyLocationOverlay); // cMapController.setZoomCurrent(15); // ( LocationManager.NETWORK_PROVIDER, ) Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); // cMapController.animateTo(new GeoPoint((int) location.getLatitude() * 1000000, (int) location.getLongitude() * 1000000));
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Source: https://habr.com/ru/post/131252/
All Articles