首页 > 解决方案 > 谷歌地图addMarker在小米MI A3中不起作用

问题描述

我正在尝试根据我从我的网络服务获得的经度和纬度移动一个标记,但问题是当我在 xiaomi mi a3 中尝试它时不起作用我得到了最后一个位置而没有任何更新我去应用程序中的其他一些地方,我回来了,我发现这个位置真的改变了。

    if (marker != null) {
        marker.setVisible(false);
    }
    marker = createMarker(SharedData.getDemandeEncours().getLatitude(), 
    SharedData.getDemandeEncours().getLongitude(), 
    SharedData.getDemandeEncours().getImmatriculation(), draw);

    public Marker createMarker(double latitude, double longitude, String title, int iconResID) {
    if (iconResID == 0) {
        return googleMape.addMarker(new MarkerOptions()
                .position(new LatLng(latitude, longitude))
                .title(title));
    } else {
        return googleMape.addMarker(new MarkerOptions()
                .position(new LatLng(latitude, longitude))
                .title(title)
                .icon(BitmapDescriptorFactory.fromResource(iconResID)));
    }
}

标签: androidgoogle-mapsxiaomi

解决方案


推荐阅读