【问题标题】:Adding a Gps Layer to my android application using arcgis runtime sdk in android studio在 android studio 中使用 arcgis runtime sdk 向我的 android 应用程序添加 Gps 层
【发布时间】:2018-07-10 04:13:08
【问题描述】:

我正在尝试在我的应用程序中向我的地图添加 GPS 图层。 问题是我没有从代码中得到好的结果。我在一些代码上得到了一个红色的亮点。 这是下面的代码。

//创建切片图层并添加到地图(也可以是ArcGISLocalTiledLayer)

ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(
        "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");


map.getLayers().add(tiledLayer);

// create a GPS layer and add to map
GPSLayer gpsLayer = new GPSLayer();
map.getLayers().add(gpsLayer); 

【问题讨论】:

    标签: android runtime arcgis


    【解决方案1】:

    使用 LocationDisplay 代替 GPSLayer

    // get the LocationDisplay from MapView
    LocationDisplay mLocationDisplay = mMapView.getLocationDisplay();
    mLocationDisplay.start();
    

    不要忘记在清单文件中添加这些行:

    <manifest ... >
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />     
    </manifest>
    

    查看示例了解更多详情: https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/display-device-location

    【讨论】:

      猜你喜欢
      • 2016-05-11
      • 2014-06-15
      • 1970-01-01
      • 2013-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-12
      相关资源
      最近更新 更多