noahd
noahd

Reputation: 862

HERE Maps: MISSING_SERVICE error

I noticed a recent uptick in errors initializing the HERE android sdk. Specifically I've seen the error MISSING_SERVICE. When I look at the documentation it says this means the mapping service is unavailable. AFAICT I don't have much control over this service. Do you know what might cause the service to not function?

Upvotes: 0

Views: 1237

Answers (2)

C. Cervantes
C. Cervantes

Reputation: 21

I spent most of the day trying to figure out why this was happening, including -invalidating my caches and restarting -deleting the apk and rebuilding (to force a new one to be created) -turning off Instant Run -wiping all data from the emulator -explicitly specifying the manifest.srcFile in the build.gradle file

In the end, my issue wasn't any of these (they're included here in case others find them helpful) but it was because my cache name in code and intent activity name in the manifest were mismatched. Specifically, I was setting the cache with

    boolean success = com.here.android.mpa.common.MapSettings.setIsolatedDiskCacheRootPath(
            getActivity().getApplicationContext().getExternalFilesDir(null) +
                    File.separator + ".here-maps", getResource().getString(R.string.app_str);

and setting the HERE map service in the manifest with

    <service
            android:name="com.here.android.mpa.service.MapService"
            android:exported="false"
            android:label="@string/app_name">
        <intent-filter>
            <action android:name="@string/app_str"/>
        </intent-filter>
    </service>

The problem, as far as I can tell, is that while the label in the XML above interprets that string as a reference, the action name does not. This meant that the code and the manifest were pointing to different places, which was causing the MISSING_SERVICE issue for me.

I resolved this by hard coding names in both places for now.

Upvotes: 2

AndrewJC
AndrewJC

Reputation: 1478

I assume you are embedding the MapService in your Application's manifest as described here [1] and not relying on a global MapService provided by another application.

If so, you can try changing the service process attribute so that it runs in a private process [2] or try using the isolated disk cache functionality [1] to see if it helps the issue. If you do end up trying either of these and it helps, please report back!

Upvotes: 1

Related Questions