【问题标题】:How do I show the device location with the ArcGIS Runtime SDK for Android?如何使用 ArcGIS Runtime SDK for Android 显示设备位置?
【发布时间】:2016-05-11 05:43:37
【问题描述】:

如何使用适用于 Android 的 ArcGIS Runtime SDK 让我的位置显示在地图上?这是我尝试过的:

mMapView = (MapView) findViewById(R.id.map);
mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {
    @Override
    public void onStatusChanged(Object o, STATUS status) {
        if (o == mMap && status == STATUS.INITIALIZED) {
            LocationDisplayManager ldm = mMap.getLocationDisplayManager();
            ldm.setAutoPanMode(LocationDisplayManager.AutoPanMode.LOCATION);
            ldm.start();
        }
    }
}

【问题讨论】:

  • 你不能在对象之间使用 ==。使用 o.equals(mMap)

标签: android geolocation location arcgis


【解决方案1】:

通过在 AndroidManifest.xml 中添加以下标记作为 <manifest> 标记的子标记,确保您的应用请求 ACCESS_FINE_LOCATION 权限:

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

(当您在那里时,您可能想要为 WRITE_EXTERNAL_STORAGEINTERNET 添加标签,因为大多数 ArcGIS Runtime 应用程序也会使用这些标签。有关详细信息,请参阅 the documentation。)

另外,请确保在您的 Android 设备上启用了位置信息。

【讨论】:

    猜你喜欢
    • 2018-11-24
    • 2014-06-15
    • 2013-12-02
    • 2013-05-22
    • 2012-12-25
    • 1970-01-01
    • 2023-04-08
    • 2019-03-20
    • 2021-03-29
    相关资源
    最近更新 更多