Google Map Marker无法在Android应用中使用(对于离线模式)

时间:2019-07-10 10:07:16

标签: cordova google-maps-markers

我已经使用Google Map和标记创建了离子应用程序(适用于iOS和Android)。我的目标是在应用程序中显示带有标记的离线地图。我已经编写了一个代码,该代码对于iOS应用程序运行正常,但是问题是,该标记未在Android应用程序的地图中显示。这个你能帮我吗。我的代码如下:

    let mapOptions: GoogleMapOptions = {
        mapType: "MAP_TYPE_ROADMAP",
        controls: {
            compass: false,
            myLocationButton: false,
            myLocation: false,
            indoorPicker: false,
            mapToolbar: false,
            zoom: false
        },
        camera: {
            target: point,
            zoom: zoom,
            tilt: 0
        },
        gestures: {
            rotate: false,
            tilt: false,
            scroll: false,
            zoom: false
        }
    };

    let element: HTMLElement = document.getElementById(id);
    // Create a map after the view is ready and the native platform is ready.
    this.map = GoogleMaps.create(element, mapOptions);

    // Wait the maps plugin is ready until the MAP_READY event

    this.map.on(GoogleMapsEvent.MAP_READY).subscribe(() => {
        this.map.addMarker({
            title: 'Ionic',
            icon: 'red',
            animation: 'DROP',
            position: point
        })
        .then(marker => {
            marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => {

            });
        });
        let cameraPos: CameraPosition<ILatLng> = {
            target: point
        };
        this.map.moveCamera(cameraPos);
    });

0 个答案:

没有答案