Answer the question
In order to leave comments, you need to log in
Why are Yandex maps not loaded on Android, MapKit 3.0 library?
I use the free version of the MapKit library (3.0) for Android, while connecting the library there was a problem displaying the map itself.
After successfully connecting the library with the key:
MapKitFactory.setApiKey("Key received through the Yandex developer's personal account");
Maps are not loaded during application startup
Code Listing:
package popovvad.findme;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.yandex.mapkit.Animation;
import com.yandex.mapkit.MapKitFactory;
import com.yandex.mapkit.geometry.Point;
import com.yandex.mapkit.map.CameraPosition;
import com.yandex.mapkit.mapview.MapView;
public class MapActivity extends AppCompatActivity {
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapKitFactory.setApiKey("Здесь мой ключ из кабинета разработчика яндекс");
MapKitFactory.initialize(this);
// Укажите имя activity вместо map.
setContentView(R.layout.map_activity);
mapView = (MapView)findViewById(R.id.mapview);
mapView.getMap().move(
new CameraPosition(new Point(55.751574, 37.573856), 11.0f, 0.0f, 0.0f),
new Animation(Animation.Type.SMOOTH, 0),
null);
}
@Override
protected void onStop() {
mapView.onStop();
MapKitFactory.getInstance().onStop();
super.onStop();
}
@Override
protected void onStart() {
super.onStart();
MapKitFactory.getInstance().onStart();
mapView.onStart();
}
}
Answer the question
In order to leave comments, you need to log in
I contacted Yandex support, they sent a letter with the text that they activated my ApiKey on the server side, the problem was gone.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question