Here Maps Android SDK PositioningManager start method returns false

倾然丶 夕夏残阳落幕 提交于 2019-12-08 05:23:22

问题


I'm using Here Maps on my Nexus 6P to test out their navigation routing logic. I've got the map setup and I'm currently trying to get my location to show up on the map.

Here maps v3.2.1 Premium Version running on Android 6.0.1

But every time I call the start method for PositioningManager instance I get a false return. Here is my code :

mapEngine.init(context, new OnEngineInitListener() {
        @Override
        public void onEngineInitializationCompleted(Error error) {
            if (error == OnEngineInitListener.Error.NONE) {

                setupMapView(mapView);

                // Start the positioning manager
                positioningManager = PositioningManager.getInstance();
                positioningManager.addListener(new WeakReference<PositioningManager.OnPositionChangedListener>(positionListener));

                if(positioningManager.start(PositioningManager.LocationMethod.GPS_NETWORK_INDOOR)){
                    Log.d(TAG, "LOCATION STARTED SUCCESSFUL");
                }else{
                    Log.d(TAG, "LOCATION STARTED UNSUCCESSFUL");
                }

                map.getPositionIndicator().setVisible(true);

                listener.onMapEngineCompleted(error);
            } else {
                // handle factory initialization failure
                Log.d(TAG, error.toString());
                Log.e(TAG, error.getDetails());
                Log.e(TAG, error.getStackTrace());
                listener.onMapEngineCompleted(error);
            }
        }
    }); 

I've also already got ACCESS_FINE_LOCATION permission granted from the system


回答1:


As I ran into the same problem, I will put the answer from @Marco's comment here. If the positioningManager.start() method is returning false you may have to include this to your AndroidManifest.xml:

<service android:enabled="true" android:exported="false" android:name="com.here.services.internal.LocationService" android:process=":remote"/>

This fixed the issue for me.



来源:https://stackoverflow.com/questions/39822535/here-maps-android-sdk-positioningmanager-start-method-returns-false

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!