问题
I started integrating HERE turn-by-turn navigation into a React Native app using the HERE SDK for Android (Premium Edition) version 3.13.3. The map view is extremely slow and sluggish although the reported rendering time is mostly between 20 and 30 ms. Using the HERE SDK Lite Edition version 4.1.4.0, the map view is snappy.
I am using a Freemium account. Could this explain the slow rendering?
App specs:
- React Native 0.60.4
- Android compile and target SDKs 28
Test device: Xiaomi Redmi Note 7
回答1:
I was eventually able to get the HERE Premium Android SDK running with React-Native at a proper framerate. The important thing is to use the AndroidXMapFragment in the view's layout:
<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>
and to inflate it in the view using an activity reference that I passed to the view's constructor:
mapLayout = (FrameLayout) activity.getLayoutInflater().inflate(R.layout.map_layout, null);
Afterwards, the map fragment can be fetched and initialized:
mapFragment = (AndroidXMapFragment) activity.getSupportFragmentManager().findFragmentById(R.id.mapfragment);
回答2:
In general the HERE Mobile SDK does not support or provide the React framework bindings, hence the responsiveness could be variable. The plans do not have an impact on responsiveness as already mentioned in the comments above
There are some independent developer who have implemented a react component with the SDK, maybe this could be of help : https://github.com/Weopt/react-native-here-maps
来源:https://stackoverflow.com/questions/59139634/here-sdk-for-android-premium-edition-renders-extremely-slowly