切换到HEREMap premium SDK后,性能降低

时间:2019-02-15 08:23:34

标签: android react-native here-api

在我的本机项目中,HEREMap Premium Android SDK遇到性能问题。以前,我使用的是HEREMap的免费版本,并且我的地图视图表现非常好。但是一旦我切换到Premium SDK,视图渲染就变得很慢。

以下是我对高级SDK集成所做的唯一更改,

  1. setIsolatedDiskCacheRootPath之前调用MapEngine.getInstance().init api
  2. 在app / src / main / AndroidManifest.xml中更新许可证密钥信息

我想念什么吗?请帮忙。

2 个答案:

答案 0 :(得分:0)

首次调用setIsolatedDiskCacheRootPath时,将花费更长的时间下载所有地图数据。因此,在更改为Premium SDK后,这是第一次的预期行为。此外,地图加载时间也取决于您的网络连接。通常,这里建议您已在您的应用中下载离线地图。

编辑:您也可以尝试删除setIsolatedDiskCacheRootPath(),但随后可以相应地更改清单文件。请参阅https://developer.here.com/documentation/android-premium/dev_guide/topics/map-service.html

中的“通过Map Service使用共享磁盘缓存”部分
<service
  android:name="com.here.android.mpa.service.MapService"
  android:label="HereMapService"
  android:process="global.Here.Map.Service.v3"
  android:exported="true" >
  <intent-filter>
    <action android:name="com.here.android.mpa.service.MapService.v3" >
    </action>
  </intent-filter>
</service>

答案 1 :(得分:0)

我遇到了完全相同的问题,并最终找到了解决方案。重要的是在视图的布局中使用AndroidXMapFragment:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        class="com.here.android.mpa.mapping.AndroidXMapFragment"
        android:id="@+id/mapfragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</FrameLayout>

,并使用我传递给视图构造函数的活动引用在视图中对其进行充气:

mapLayout = (FrameLayout) activity.getLayoutInflater().inflate(R.layout.map_layout, null);

然后,可以提取并初始化地图片段:

mapFragment = (AndroidXMapFragment) activity.getSupportFragmentManager().findFragmentById(R.id.mapfragment);