We're currently using Skobbler 2.5 to build an Android navigation app. One function within the app, allows you place annotations along a previously computed route. The annotations can be placed on the map while the SKMap is visible on screen or while it's in the background.
We have noticed that occasionally when adding annotations while the map is not currently visible and then going ahead and making the map visible results in black rectangles showing up in places where the annotations have been added.
The annotations themselves are added using the deprecated .setImagePath()
method, but this is due to a workaround that was set up to make annotations visible when zooming out the map to a zoom level less than 4.
Here is an example of how annotations are currently added:
SKAnnotation annotation = new SKAnnotation(i++);
annotation.getLocation().setLongitude(result.longitude);
annotation.getLocation().setLatitude(result.latitude);
// annotation.setAnnotationType(SKAnnotation.SK_ANNOTATION_TYPE_PURPLE);
annotation.setMininumZoomLevel(2);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
if (metrics.densityDpi < DisplayMetrics.DENSITY_HIGH) {
annotation.setImagePath(SKMaps.getInstance().getMapInitSettings().
getMapResourcesPath() + "/.Common/icon_greypin@2x.png");
// set the size of the image in pixel
annotation.setImageSize(128);
} else {
annotation.setImagePath(SKMaps.getInstance().getMapInitSettings().
getMapResourcesPath() + "/.Common/icon_greypin@3x.png");
// set the size of the image in pixels
annotation.setImageSize(256);
}
mapView.addAnnotation(annotation, SKAnimationSettings.ANIMATION_POP_OUT);
Yet for some reason occasionally the map will appear like this:
Usually, it should look more like this:
Does anyone have any experience with this issue and know of a way to handle it correctly? Or perhaps there is some sort of race condition that I need to look out for?
Thanks for any help on the matter! Keith
I would have to look at all your project for a detailed answer. Absent that: