I am testing the map kit from Huawei.
The app has been created in App Gallery Connect and I did all the steps. Other HMS services working just right. All my dependencies are right.
So, I use a view to represent the map.
The onMapReady
is called, view loads, I can interact with the map, add pins, find my location, etc.
But I cant see the map, only blank tiles.
I dont get an error, onMapReady
is called just fine.
Also i have tried the demo from Huawei's Github, the result is the same. I have tried with fragment too, same result.
My mapView
<com.huawei.hms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:cameraTargetLat="48.893478"
map:cameraTargetLng="2.334595"
map:cameraZoom="8.5"/>
My onCreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_huawei_map_test);
Log.d(TAG, "yo: ");
if (!hasPermissions(this, RUNTIME_PERMISSIONS)) {
ActivityCompat.requestPermissions(this, RUNTIME_PERMISSIONS, 100);
}
mMapView = findViewById(R.id.mapView);
Bundle mapViewBundle = null;
if (savedInstanceState != null) {
mapViewBundle = savedInstanceState.getBundle(MAPVIEW_BUNDLE_KEY);
}
MapsInitializer.setApiKey("");//my key
mMapView.getMapAsync(this);
mMapView.onCreate(mapViewBundle);
My onMapReady
@Override
public void onMapReady(HuaweiMap map) {
//get map instance in a callback method
Log.d(TAG, "onMapReady: ");
hMap = map;
//hMap.setMapType(HuaweiMap.MAP_TYPE_TERRAIN);
hMap.setMyLocationEnabled(true);
hMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(48.893478, 2.334595), 10));
Marker mMarker = hMap.addMarker(new MarkerOptions().position(new LatLng(48.893478, 2.334595)));
mMarker.showInfoWindow();
}
The result: