Android上的Skobbler SDK:SKMapSurfaceListener.onAnnotationSelected不会被调用

时间:2014-06-16 12:22:54

标签: android skmaps

我有SKMapSurfaceView我已经设置了一个监听器(通过setMapSurfaceListener,传入一个SKMapSurfaceListener对象)。当我点击通过SKMapSurfaceView添加到addAnnotation的注释时,听众会收到onSingleTap个事件,但不会onAnnotationSelected。我在Skobbler的日志中看到它检测到点击自定义POI",我认为这是我的注释(特别是因为他们日志中自定义POI的ID是唯一的ID,我给了我的注释)。但是我的听众不会调用onAnnotationSelectedonCustomPOISelected。为什么呢?

编辑:这是我的代码:

        SKAnnotation annotation = new SKAnnotation();
        annotation.setUniqueID(123456);
        annotation.setLocation(new SKCoordinate(
                13.45457,
                52.51592));
        annotation.setMininumZoomLevel(15);
        annotation.setAnnotationType(SKAnnotation.SK_ANNOTATION_TYPE_MARKER);
        mapView.addAnnotation(annotation);

        mapView.setMapSurfaceListener(new SKMapSurfaceListener() {
            @Override
            public void onSurfaceCreated() {
            }

            @Override
            public void onSingleTap(SKScreenPoint arg0) {
                Log.d("onSingleTap");
            }

            @Override
            public void onScreenOrientationChanged() {
            }

            @Override
            public void onRotateMap() {
            }

            @Override
            public void onPOIClusterSelected(SKPOICluster arg0) {
                Log.d("onPOIClusterSelected");
            }

            @Override
            public void onMapRegionChanged(SKCoordinate arg0) {
            }

            @Override
            public void onMapPOISelected(SKMapPOI arg0) {
                Log.d("onMapPOISelected");
            }

            @Override
            public void onMapActionUp(SKScreenPoint arg0) {
            }

            @Override
            public void onMapActionDown(SKScreenPoint arg0) {
            }

            @Override
            public void onLongPress(SKScreenPoint arg0) {
            }

            @Override
            public void onInternetConnectionNeeded() {
            }

            @Override
            public void onInternationalisationCalled(int arg0) {
            }

            @Override
            public void onDoubleTap(SKScreenPoint arg0) {
                Log.d("onDoubleTap");
                float zoom = mapView.getZoomLevel() + 1;
                if (zoom <= SKMapSurfaceView.MINIMUM_ZOOM_LEVEL) {
                    mapView.setZoomSmooth(zoom, 250);
                }
            }

            @Override
            public void onCustomPOISelected(SKMapCustomPOI arg0) {
                Log.d("onCustomPOISelected");
            }

            @Override
            public void onCompassSelected() {
            }

            @Override
            public void onAnnotationSelected(SKAnnotation annotation) {
                Log.d("onAnnotationSelected");
            }

            @Override
            public void onAnimationsFinished() {
            }

            @Override
            public void onActionZoom() {
                Log.d("onActionZoom");
            }

            @Override
            public void onActionPan() {
                Log.d("onActionPan");
            }
        });

然后我得到的日志如果我在某个地方点击而不是注释,然后点击注释:

06-22 19:34:27.674: D/SKMaps(20852): MapRenderer----onSurfaceCreated
06-22 19:34:27.679: D/SKMaps(20852): MapRenderer---- LinInitialized = true 
06-22 19:34:28.394: D/SKMaps(20852): MapRenderer----Map follower mode 0
06-22 19:34:28.394: D/SKMaps(20852): MapRenderer----onSurfaceChanged width = 1080 height= 1701
...
06-22 19:35:11.729: D/SKMaps(20852): SKMapSurfaceView----SINGLE TAP  CONFIRMED 0
06-22 19:35:11.729: D/SKMaps(20852): SKMapSurfaceView----Check north indicator   4 526.0 705.0 296 64 0 64
06-22 19:35:11.729: D/SKMaps(20852): SKMapSurfaceView----notifyWithMapInfo
06-22 19:35:11.759: D/Wanderant(20852): onSingleTap
06-22 19:35:17.399: D/SKMaps(20852): SKMapSurfaceView----SINGLE TAP  CONFIRMED 0
06-22 19:35:17.399: D/SKMaps(20852): SKMapSurfaceView----Check north indicator   4 532.0 720.0 296 64 0 64
06-22 19:35:17.399: D/SKMaps(20852): SKMapSurfaceView----notifyWithMapInfo
06-22 19:35:17.429: D/SKMaps(20852): SKMapSurfaceView---- Tapped custom POI id=123456
06-22 19:35:17.429: D/Wanderant(20852): onSingleTap

正如您所看到的,在这两种情况下我都会获得onSingleTap回调。 (我已经跳过了Skobbler地图初始化代码,但它根据教程完成,它确实成功初始化并显示地图等。)

1 个答案:

答案 0 :(得分:0)

您遇到的问题是5月19日SDK出现的错误。

我们在下一次SDK更新(2014年6月30日ETA)中测试了此行为,现在每次都正确调用onAnnotationSelected。因此,请在新版本可用后更新您的SDK(如果有更新,您应该会收到电子邮件/简报)