Giter VIP home page Giter VIP logo

here-android-sdk-examples's Introduction

Build Status

HERE Mobile SDK 3.x for Android example projects

Deprecated

Copyright (c) 2011-2021 HERE Europe B.V.

This repository holds a series of Java-based projects using the HERE Mobile SDK 3.x for Android. More information about the API can be found on the HERE Developer Portal's Mobile SDKs page.

Note: This service is no longer being actively developed. We will only provide critical fixes for this service in future. Instead, use the new HERE SDK 4.x HERE Premium SDK (3.x) is superseded by new 4.x SDK variants and the Premium SDK will be maintained until 31 December 2022 with only critical bug fixes and no feature development / enhancements. Current users of the HERE Premium SDK (3.x) are encouraged to migrate to Lite, Explore or Navigate HERE SDK (4.x) variants based on licensed use cases before 31 December 2022. Most of the Premium SDK features are already available in the new SDK variants. Onboarding of new customers for Premium SDK is not possible.

This set of individual, use-case based projects is designed to be cloned by developers for their own use.

Note: In order to be able to build the examples, you have to sign up for a 90-day Free Trial. After signing in with a HERE account, follow these steps to download the HERE Mobile SDK (Premium):

  1. Choose to Generate App ID and App Code for use with the HERE Mobile SDK for Android: Generate App ID and App Code

  2. Enter the package name of the example you want to build, e.g. com.here.android.example.map.basic. The package name entered here must match the name in your app: Enter package name

  3. Click on GENERATE to obtain the App ID, App Code, and License Key: Enter package name

  4. Click on Download SDK to get a files named like HERE_Android_SDK_Premium_v3.16.2_101.zip (your version number might differ).

  5. Extract HERE_Android_SDK_Premium_v3.16.2_101.zip as well as the contained HERE-sdk.zip.

  6. Copy the contained HERE-sdk/libs/HERE-sdk.aar file to your example's libs directory. Again taking the map-rendering example, the libs directory would be here.

  7. Replace the instances of the {YOUR_APP_ID}, {YOUR_APP_CODE} and {YOUR_LICENSE_KEY} placeholders in the example's AndroidManifest.xml with your obtained values. Yet again looking at the map-rendering examples, this would be here, here and here.

  8. Replace the instances of the {YOUR_LABEL_NAME} placeholders in the example's AndroidManifest.xml with your own custom values. Do not reuse HERE Mobile SDK defaults.

  9. Launch Android Studio and import the example's build.gradle file.

  10. Run the app.

License

Unless otherwise noted in LICENSE files for specific files or directories, the LICENSE in the root applies to all content in this repository.

HERE Mobile SDK for Android (Premium)

All of the following projects use latest version(currently 3.16) of the HERE Mobile SDK for Android (Premium)

here-android-sdk-examples's People

Contributors

ambroseli avatar ananthrajsingh avatar freethan avatar johnlxiang avatar lorymk avatar makra avatar markoturhere avatar merlin1sthere avatar mkarpicki avatar mmarcon avatar nazarkacharaba avatar olrudenk avatar princessl avatar saschpe avatar silvestrpredko avatar sirbif avatar sirius2551ak avatar sschuberth avatar starand avatar tlushney avatar ybrushz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

here-android-sdk-examples's Issues

HereMaps in DialogFragment Any idea how to refresh or reload maps

Hi Can you please put example of having Map in DialogFragment.
Specially I have the listView with different latitude and longitude, When I an item it opens DialogFragment which shows the map with route to the clicked item lat,lng.
Problem is on first click maps are loaded successfully I can see all tiles and routing line. But When I click second item or any same item again it shows map without tiles.
Here is my code

import android.app.DialogFragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.here.android.mpa.common.GeoCoordinate;
import com.here.android.mpa.common.OnEngineInitListener;
import com.here.android.mpa.mapping.Map;
import com.here.android.mpa.mapping.MapFragment;
import com.here.android.mpa.mapping.MapRoute;
import com.here.android.mpa.routing.RouteManager;
import com.here.android.mpa.routing.RouteOptions;
import com.here.android.mpa.routing.RoutePlan;
import com.here.android.mpa.routing.RouteResult;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

public class MapViewDialogFragment extends DialogFragment {

private JSONObject jsonJob;

// map embedded in the map fragment
private Map map = null;
private MapRoute m_mapRoute;
final String MAP_TAG = "map_tag";

// map fragment embedded in this activity
private MapFragment mapFragment = null;

private boolean paused = false;

private View rootView;

private Double clat;
private Double clng;
private Double dlat;
private Double dlng;

public MapViewDialogFragment() {
    // Required empty public constructor
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    rootView = inflater.inflate(R.layout.fragment_map_view_dialog, container, false);

    String jobContent = this.getArguments().getString("JOB_KEY");
    try {
        jsonJob = new JSONObject(jobContent);
        String collection = jsonJob.getString("CollectionJson");
        String delivery = jsonJob.getString("DeliveryJson");
        JSONObject colJson = new JSONObject(collection);
        JSONObject delJson = new JSONObject(delivery);
        clat = colJson.getDouble("latitude");
        clng = colJson.getDouble("longitude");
        dlat = delJson.getDouble("latitude");
        dlng = delJson.getDouble("longitude");

        Log.e("LaLng---OOO",String.format("%f,%f -- %f,%f",clat,clng,dlat,dlng));

        // Search for the map fragment to finish setup by calling init().
        mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.mapRouteFragment);
        mapFragment.init(this.getContext(), new OnEngineInitListener() {
            @Override
            public void onEngineInitializationCompleted(
                    OnEngineInitListener.Error error)
            {
                if (error == OnEngineInitListener.Error.NONE) {
                    // retrieve a reference of the map from the map fragment
                    map = mapFragment.getMap();
                    // Set the map center to the Vancouver region (no animation)
                    map.setCenter(new GeoCoordinate(clng, clat, 0.0),
                            Map.Animation.NONE);
                    // Set the zoom level to the average between min and max
                    map.setZoomLevel(7);

                    // Declare the rm variable (the RouteManager)
                    RouteManager rm = new RouteManager();
                    // Create the RoutePlan and add two waypoints
                    RoutePlan routePlan = new RoutePlan();
                    routePlan.addWaypoint(new GeoCoordinate(clng, clat));
                    routePlan.addWaypoint(new GeoCoordinate(dlng, dlat));
                    // Create the RouteOptions and set its transport mode & routing type
                    RouteOptions routeOptions = new RouteOptions();
                    routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
                    routeOptions.setRouteType(RouteOptions.Type.FASTEST);

                    routePlan.setRouteOptions(routeOptions);

                    // Calculate the route
                    rm.calculateRoute(routePlan, new RouteListener());

                } else {
                    Log.e("HereMaps","ERROR: Cannot initialize Map Route Fragment "+error.toString());
                }
            }
        });
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return rootView;
}

private class RouteListener implements RouteManager.Listener {

    // Method defined in Listener
    public void onProgress(int percentage) {
        // Display a message indicating calculation progress
    }

    // Method defined in Listener
    public void onCalculateRouteFinished(RouteManager.Error error, List<RouteResult> routeResult) {
        // If the route was calculated successfully
        if (error == RouteManager.Error.NONE) {
            // Render the route on the map
            m_mapRoute = new MapRoute(routeResult.get(0).getRoute());
            map.addMapObject(m_mapRoute);
        }
        else {
            // Display a message indicating route calculation failure
        }
    }
}

@Override
public void onDestroyView() {
    super.onDestroyView();
    if (map != null && m_mapRoute != null) {
        map.removeMapObject(m_mapRoute);
        m_mapRoute = null;
        //map = null;
    }
    if (mapFragment != null)
        getFragmentManager().beginTransaction().remove(mapFragment).commit();
}

@Override
public void onResume() {

    // TODO Auto-generated method stub
    super.onResume();
    map = mapFragment.getMap();
}

}
`

Here Maps MapView does not work in Fragment

I am trying to implement Here Maps in Fragment but it does not work. I got crash.

Logs:

[at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
        Suppressed: java.lang.Throwable: HERE SDK Version: 3.7.0.118
        at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
        Suppressed: java.lang.Throwable: HERE SDK Version: 3.7.0.118
        at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
        at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:379)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
     Caused by: com.here.android.mpa.common.UnintializedMapEngineException: Cannot create HERE SDK object before MapEngine is initialized. See MapEngine.init()
        at com.nokia.maps.BaseNativeObject.u(BaseNativeObject.java:39)
        at com.nokia.maps.BaseNativeObject.<init>(BaseNativeObject.java:26)
        at com.nokia.maps.MapImpl.<init>(MapImpl.java:424)
        at com.here.android.mpa.mapping.Map.<init>(Map.java:710)
        at ie.globetech.transitconnex.activity.bustrips.BusTripFragment.onEngineInitializationCompleted(BusTripFragment.java:179)
        at com.here.android.mpa.common.MapEngine.init(MapEngine.java:279)
        at ie.globetech.transitconnex.activity.bustrips.BusTripFragment.onCreate(BusTripFragment.java:136)
        at android.support.v4.app.Fragment.performCreate(Fragment.java:2331)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1386)
        at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1188)
        at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1071)
        at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:115)
        at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2380)
        at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2245)
        at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3248)
        at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3200)
        at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195)
        at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:597)
        at ie.globetech.transitconnex.activity.bustrips.BusTripMainActivity.onStart(BusTripMainActivity.java:125)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
        at android.app.Activity.performStart(Activity.java:6965)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2934)
            ... 9 more](url)

Layout:

<com.here.android.mpa.mapping.MapView
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true" />

Fragment:

 public class BusTripFragment extends Fragment{

           private Activity mActivity;
           private Map map = null;
           private MapView mapView;

             @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    ApplicationContext appContext = new ApplicationContext(mActivity.getApplicationContext());
                    MapEngine.getInstance().init(appContext, this);

              }

 @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            mActivity = (Activity) activity;
            //mCallbacks = (MyNavigationDrawerCallbacks) activity;
        } catch (ClassCastException e) {}
    }


        @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                View view = inflater.inflate(R.layout.trip_fragment, container, false);
               mapView = (MapView) view.findViewById(R.id.map);
               return view;      
                }

    @Override
        public void onEngineInitializationCompleted(Error error) {

            // retrieve a reference of the map from the map fragment
            //map = mapFragment.getMap();

            isMapEngineInitialized = true;

            if (map == null) {
                map = new Map();
            }

            mapView.setMap(map);

            // Set the map center to the Vancouver region (no animation)
            map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0), Map.Animation.NONE);

            // Set the zoom level to the average between min and max
            map.setZoomLevel((map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
        }

     }

I am using HERE SDK for Android Version: 3.7.0.118

JNI Segmentation Error

We are developing multiple way point turn-by-turn navigation application: Here Navigation module Occasionally die, killing map activity. The root cause of the problem: C/C++ jni modules of HERE libraries die because of segment error (memory access error) :

06-13 14:56:13.771 13750 13750 F google-breakpad: Microdump skipped (uninteresting)
06-13 14:56:13.791 13434 13589 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
06-13 14:56:13.791 13434 13589 W google-breakpad: Chrome build fingerprint:
06-13 14:56:13.791 13434 13589 W google-breakpad: 1.0
06-13 14:56:13.791 13434 13589 W google-breakpad: 1
06-13 14:56:13.791 13434 13589 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
06-13 14:56:13.791 13434 13589 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 13589 (NavigationManag)

It happens often at spots where way points are too close. For example, at sharp turns with 2-3 way points very close nearby

It appears to me that when distance between way points are below GPS resolution (10-20 meters), The HERE library is not very stable.

Unable to resolve NavigationManger Class

In my case I need to show turn-by-turn navigation for which I need to use "NavigationManager" but I am unable to resolve this class. I imported the lib folder into my project but can't able to find this class in "Here SDK" .

GeoBoundingBox.getCenter() return wrong coordinate

I create a GeoBoundingBox using the top-left and bottom-right coordinates, then pass it to mMap.zoomTo() method.

GeoBoundingBox boundingBox = new GeoBoundingBox(northeast, southwest);
mMap.zoomTo(boundingBox, Map.Animation.BOW, Map.MOVE_PRESERVE_ORIENTATION);

Problem is the map start to zoom to the wrong location across the globe. Debugging shows that the GeoBoundingBox return the wrong center point.

screen shot 2018-03-21 at 3 10 33 pm

Routing errors due to connectivity loss are hard to trace

Regarding routing errors, the CoreRouter.Listener and NavigationManager.RerouteListener interfaces aren't consistent with each other: On initial route calculation, Listener.onCalculateRouteFinished() will receive RouteResults as well as RoutingErrors. So I can tell, for example, if route calculation failed due to network loss (GRAPH_DISCONNECTED).

There is however no such mechanism in NavigationManager.RerouteListener: onRerouteFailed() gives no reason why route recalculation failed.Also, onRerouteEnd() will be called with the old RouteResult (or so it seems) if connectivity was lost, instead of onRerouteFailed().

IMO it would be best if the SDK would provide a callback that communicates connection loss with HERE servers.

Get unknown error while initializing map engine

@andrewcarter I am getting the same error tried both these solutions but not working.

  1. Uninstall all of the apps you currently have installed which use the HERE SDK. Delete the shared map disk cache folder. It is located at getExternalStorageDirectory()/.here-maps, so for most devices the adb command to delete is: adb shell rm -r /sdcard/.here-maps

  2. In your app specify an isolated disk cache location and MapService component as described here: Using an Isolated Map Disk Cache with the Map Service

here is the logcat:

06-07 15:21:52.138 23216 23216 E milezero_response: Map initialization error UNKNOWN details: Native engine initialization failed for unknown reason. stacktrace: java.lang.Throwable
06-07 15:21:52.138 23216 23216 E milezero_response: at com.nokia.maps.aw.a(EngineError.java:27)
06-07 15:21:52.138 23216 23216 E milezero_response: at com.nokia.maps.MapsEngine$h.a(MapsEngine.java:857)
06-07 15:21:52.138 23216 23216 E milezero_response: at com.nokia.maps.MapsEngine$h.a(MapsEngine.java:733)
06-07 15:21:52.138 23216 23216 E milezero_response: at com.nokia.maps.MapsEngine$h.doInBackground(MapsEngine.java:717)
06-07 15:21:52.138 23216 23216 E milezero_response: at android.os.AsyncTask$2.call(AsyncTask.java:304)
06-07 15:21:52.138 23216 23216 E milezero_response: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-07 15:21:52.138 23216 23216 E milezero_response: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
06-07 15:21:52.138 23216 23216 E milezero_response: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
06-07 15:21:52.138 23216 23216 E milezero_response: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
06-07 15:21:52.138 23216 23216 E milezero_response: at java.lang.Thread.run(Thread.java:761)
06-07 15:21:52.176 23216 23521 W cr_CrashFileManager:

Cannot created HERE SDK objects before MapEngine is initialized.

I am accessing the sample application and getting the error. Can any one please help here?

FATAL EXCEPTION: main
Process: com.here.android.example.guidance, PID: 30111
com.here.android.mpa.common.UnintializedMapEngineException: Cannot created HERE SDK objects before MapEngine is initialized. See MapEngine.init()

Cant resolve HERE-sdk dependency

I clone the demo app and tried running it using Android studio.
But I am unable to install it, since this dependency is not met.

compile(name: 'HERE-sdk', ext: 'aar')

Can anyone help ?

libMAPSJNI.so Crash

Device : samsung s8

A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0xd5002ae4 in tid 23315 (RDMRenderDb0-0)

                                                        [ 10-11 11:17:01.513   507:  507 W/         ]
                                                        debuggerd: handling request: pid=23191 uid=10318 gid=10318 tid=23315

10-11 11:17:01.621 23780-23780/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-11 11:17:01.621 23780-23780/? A/DEBUG: Build fingerprint: 'samsung/dreamqlteue/dreamqlteue:7.0/NRD90M/G950U1UEU1AQE3:user/release-keys'
10-11 11:17:01.621 23780-23780/? A/DEBUG: Revision: '12'
10-11 11:17:01.622 23780-23780/? A/DEBUG: ABI: 'arm'
10-11 11:17:01.622 23780-23780/? A/DEBUG: pid: 23191, tid: 23315, name: RDMRenderDb0-0 >>> packagename <<<
10-11 11:17:01.622 23780-23780/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xd5002ae4
10-11 11:17:01.622 23780-23780/? A/DEBUG: r0 b5002ae0 r1 ee0049b4 r2 d5002adc r3 00000002
10-11 11:17:01.622 23780-23780/? A/DEBUG: r4 f44f6988 r5 f44f698a r6 ffffffe1 r7 00000000
10-11 11:17:01.622 23780-23780/? A/DEBUG: r8 00000000 r9 00000004 sl ebd80b3c fp fffffff0
10-11 11:17:01.622 23780-23780/? A/DEBUG: ip 07ffffff sp bb8ff088 lr edfc7021 pc edfc7184 cpsr 200f0030
10-11 11:17:01.633 23780-23780/? A/DEBUG: backtrace:
10-11 11:17:01.633 23780-23780/? A/DEBUG: #00 pc 00055184 /system/lib/libc.so (arena_run_reg_alloc+111)
10-11 11:17:01.633 23780-23780/? A/DEBUG: #1 pc 0005501d /system/lib/libc.so (je_arena_tcache_fill_small+172)
10-11 11:17:01.633 23780-23780/? A/DEBUG: #2 pc 0006fccd /system/lib/libc.so (je_tcache_alloc_small_hard+16)
10-11 11:17:01.634 23780-23780/? A/DEBUG: #3 pc 000643c5 /system/lib/libc.so (je_malloc+852)

/lib/arm/libgnustl_shared.so (_Znwj+20)
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so
/lib/arm/libMAPSJNI.so

No implementation found for void com.nokia.maps.ApplicationContextImpl.initNative

Hi we are getting error with android sdk premimum pasting activity code part and logcat output

protected void onCreate(Bundle savedInstanceState) {
//        setTheme(R.style.Theme_Transparent);
        super.onCreate(savedInstanceState);

        Log.d(TAG,"onCreate");

        setContentView(R.layout.activity_main);

        final MapFragment mapFragment = (MapFragment)
                getFragmentManager().findFragmentById(R.id.mapfragment);
        // initialize the Map Fragment and
        // retrieve the map that is associated to the fragment
        mapFragment.init(new OnEngineInitListener() {
            @Override
            public void onEngineInitializationCompleted(
                    OnEngineInitListener.Error error) {
                if (error == OnEngineInitListener.Error.NONE) {
                    // now the map is ready to be used
                    Map map = mapFragment.getMap();
                    // ...
                } else {
                    Log.e("HereActivity","ERROR: Cannot initialize MapFragment "+error);
//                    System.out.println("ERROR: Cannot initialize MapFragment "+error);
                }
            }
        });
    }

activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
    <!-- Map Fragment embedded with the map object -->
    <fragment
        class="com.here.android.mpa.mapping.MapFragment"
        android:id="@+id/mapfragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

Logcat outout

D/AndroidRuntime(30815): Shutting down VM
E/AndroidRuntime(30815): FATAL EXCEPTION: main
E/AndroidRuntime(30815): Process: global.Here.Map.Service.v3, PID: 30815
E/AndroidRuntime(30815): java.lang.UnsatisfiedLinkError: No implementation found
 for void com.nokia.maps.ApplicationContextImpl.initNative(android.content.Conte
xt, boolean) (tried Java_com_nokia_maps_ApplicationContextImpl_initNative and Ja
va_com_nokia_maps_ApplicationContextImpl_initNative__Landroid_content_Context_2Z
)
E/AndroidRuntime(30815):        at com.nokia.maps.ApplicationContextImpl.initNat
ive(Native Method)
E/AndroidRuntime(30815):        at com.nokia.maps.ApplicationContextImpl.a(Appli
cationContextImpl.java:343)
E/AndroidRuntime(30815):        at com.here.android.mpa.service.MapService.onSta
rtCommand(MapService.java:357)
E/AndroidRuntime(30815):        at android.app.ActivityThread.handleServiceArgs(
ActivityThread.java:3316)
E/AndroidRuntime(30815):        at android.app.ActivityThread.access$2200(Activi
tyThread.java:177)
E/AndroidRuntime(30815):        at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:1547)
E/AndroidRuntime(30815):        at android.os.Handler.dispatchMessage(Handler.ja
va:102)
E/AndroidRuntime(30815):        at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(30815):        at android.app.ActivityThread.main(ActivityThrea
d.java:5951)
E/AndroidRuntime(30815):        at java.lang.reflect.Method.invoke(Native Method
)
E/AndroidRuntime(30815):        at java.lang.reflect.Method.invoke(Method.java:3
72)
E/AndroidRuntime(30815):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:1400)
E/AndroidRuntime(30815):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:1195)
I/AndroidRuntime(30539): VM exiting with result code 0, cleanup skipped.

jni segmentation error

Here Navigation module Occasionally die, killing map activity.
The root cause of the problem: C/C++ jni modules of HERE libraries die because of segment error (memory access error) :

06-13 14:56:13.771 13750 13750 F google-breakpad: Microdump skipped (uninteresting)
06-13 14:56:13.791 13434 13589 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
06-13 14:56:13.791 13434 13589 W google-breakpad: Chrome build fingerprint:
06-13 14:56:13.791 13434 13589 W google-breakpad: 1.0
06-13 14:56:13.791 13434 13589 W google-breakpad: 1
06-13 14:56:13.791 13434 13589 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
06-13 14:56:13.791 13434 13589 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 13589 (NavigationManag)

It happens often at spots where way points are too close
For example, at sharp turns with 2-3 way points very close nearby

It appears to me that when distance between way points are below GPS resolution (10-20 meters), The HERE library is not very stable. I will raise a bug report to HERE

Basic Postioning

Non-premium SDK basic positioning is way faster than the premium basic positioning why?

I have two samples running one with premium and non-premium the app, with non-premium version, loads the current location smoother and faster, while premium I need to use position manager to load current location and its too slow any idea?

Unable to call NavigationManager.NewInstructionEventListener

In the existing android code of turn by turn navigation, in MapFragmentView.java, I have added
private NavigationManager.NewInstructionEventListener instructionHandler = new NavigationManager.NewInstructionEventListener() {
@OverRide
public void onNewInstructionEvent() {
Log.d("Bindu","onNewInstruction");
Maneuver m = NavigationManager.getInstance().getNextManeuver();
Log.d(TAG, "New instruction : in " + NavigationManager.getInstance().getNextManeuverDistance() + " m do " + m.getTurn().name() + " / " + m.getAction().name() + " on " + m.getNextRoadName() + " (from " + m.getRoadName() + ")");
// ...
// do something with this information, e.g. show it to the user
super.onNewInstructionEvent();
}
};
and I am calling this function from addNavigationListeners() by calling this:
m_navigationManager.addNewInstructionEventListener(new WeakReference<>(instructionHandler));
But function call is not getting delegated.Kindly let me know where I am doing the mistake.

Thank you

[init project] Got MISSING_LIBRARIES error

  • step 1.
    download HERE-sdk.aar into app/libs folder
  • step 2.
    setting build.gradle
repositories { 
    flatDir {
        dirs 'libs'
    }
}
dependencies {
    compile (name :'here-sdk', ext:'aar')
}
  • step 3. setting app id, app token, license key
<meta-data
    android:name="com.here.android.maps.appid"
    android:value="my app id" />
<meta-data
    android:name="com.here.android.maps.apptoken"
    android:value="my app token" />
<meta-data
    android:name="com.here.android.maps.license.key"
    android:value="my license key" />
  • step 4. init map fragment
    xml
    <fragment
        android:id="@+id/mapFragment"
        class="com.here.android.mpa.mapping.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

init map fragment

mapFragment.init(new OnEngineInitListener() {
            @Override
            public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
                // got error MISSING_LIBRARIES
               //  how do i fix it?
            }
}

ERROR : Cannot initialize map with error : UNKNOWN

Thanks in advance!
I have been trying to run the simple heremaps example apps in android studio 3.0.1 using my phone Redmi 4 (marshmallow), but everytime I face this issue ->

                                ERROR : Cannot initialize map with error : UNKNOWN

And then the on clicking any button the app simply crashes. I have googled a lot and have performed all the steps correctly.

  • step 1.
    download HERE-sdk.aar into app/libs folder
  • step 2.
    setting build.gradle
  • step 3.
    setting app id, app token, license key. The package name in the same in my app and the heremaps website.

Here is the code of AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!--Developers should put application credentials here.To obtain them, please register the application
     at https://developer.here.com/develop/mobile-sdks-->
    <meta-data
        android:name="com.here.android.maps.appid"
        android:value="mpKhTK1bbxvdPstxE0qx" />
    <meta-data
        android:name="com.here.android.maps.apptoken"
        android:value="_QF2rIfGgk_-Z0LYOQduAw" />
    <meta-data
        android:name="com.here.android.maps.license.key"
        android:value="c/2m8I4SQmHNH2N45CkDnWNtsN/58aK+8cSfK9XzFsGWAHt7WXFDBnNRYr8uEaKKT4zCyLTZhsIsz29z/sgfHikrOyX61on3n8wFIZqCnOJKeeDPmUHTNfOu2HzVmY/fwIbih+N6kw6K1QJpvaZHYsPbtbb+VvQKTIJH+uPq66Cp5bdBGWreF/CipyFb160g7kCXw0y1V8SvJ23R0ueQG/nM59lHtfFzEuboLNTfvesNwfDGmIx04A+PVS42hWKFEyldoSr64nrpuPcoBCKCcfUIW/ctXU1UYzAn8Hi0mCn6wZRAcGx/VJsU47MODzEMCbcc05wjCrtU1En89ieyt2ayAF0h2jdeANfmKrE0LcPLNYkE9K199/JiKM68PxAbP7YlvFy0uIKRK54EXxZ2FC1XVcAMtOy51QNfAScRtSsJ2a2JiIZEyUtBC0K6Kqtbl3I6eUiNilhb9M9CkRK8gYsalkRnYQJ+iNxyDIdTGI6Y3hUVgmRfHnI/MDtDeqtAEMpgqKFDTvYWvl31vIOZ4S5Xpk0TfwQFctOyywgLT/oMc6rZpPF/YibDQQWLjDi9moXPggbGPNTJMb+m88X7NRrcqYVYxIHyvwKsAAXzftPhW9c8u92X9cjCZwbEmnZ4wOY+gO99+4qA5A0rha0hP1WyVEo0Lep1W/8AebDXTpY=" />

     <!--Developers should always provide custom values for each of {YOUR_LABEL_NAME} and {YOUR_INTENT_NAME}.
     Do not reuse HERE SDK defaults.-->
    <meta-data
        android:name="INTENT_NAME"
        android:value="android.intent.action.MAIN" />
    <service
        android:name="com.here.android.mpa.service.MapService"
        android:label="@string/app_name"
        android:process="global.Here.Map.Service.v2"
        android:exported="true" >
        <intent-filter>
            <action android:name="com.here.android.mpa.service.MapService" >
            </action>
        </intent-filter>
    </service>

</application>

code for MainActivity.java:

`package com.here.android.example.routing;
import java.util.ArrayList;
import java.util.List;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

/**

  • Main activity which launches map view and handles Android run-time requesting permission.
    */

public class MainActivity extends AppCompatActivity {

private final static int REQUEST_CODE_ASK_PERMISSIONS = 1;
private MapFragmentView m_mapFragmentView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    requestPermissions();
}


private void requestPermissions() {

    final List<String> requiredSDKPermissions = new ArrayList<String>();
    requiredSDKPermissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
    requiredSDKPermissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
    requiredSDKPermissions.add(Manifest.permission.INTERNET);
    requiredSDKPermissions.add(Manifest.permission.ACCESS_WIFI_STATE);
    requiredSDKPermissions.add(Manifest.permission.ACCESS_NETWORK_STATE);

    ActivityCompat.requestPermissions(this,
            requiredSDKPermissions.toArray(new String[requiredSDKPermissions.size()]),
            REQUEST_CODE_ASK_PERMISSIONS);
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
        @NonNull int[] grantResults) {
    switch (requestCode) {
        case REQUEST_CODE_ASK_PERMISSIONS: {
            for (int index = 0; index < permissions.length; index++) {
                if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {

                    /**
                     * If the user turned down the permission request in the past and chose the
                     * Don't ask again option in the permission request system dialog.
                     */
                    if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
                            permissions[index])) {
                        Toast.makeText(this,
                                "Required permission " + permissions[index] + " not granted. "
                                        + "Please go to settings and turn on for sample app",
                                Toast.LENGTH_LONG).show();
                    } else {
                        Toast.makeText(this,
                                "Required permission " + permissions[index] + " not granted",
                                Toast.LENGTH_LONG).show();
                    }
                }
            }

            /**
             * All permission requests are being handled.Create map fragment view.Please note
             * the HERE SDK requires all permissions defined above to operate properly.
             */
            m_mapFragmentView = new MapFragmentView(this);
            break;
        }
        default:
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}

}`

code for build.gradle:

`apply plugin: 'com.android.application'
android {
compileSdkVersion 23

defaultConfig {
    applicationId 'com.here.android.example.routing'
    minSdkVersion 16

    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

repositories {
flatDir {
dirs 'libs'
}
}

dependencies {
compile(name:'HERE-sdk', ext:'aar')
implementation(name: 'HERE-sdk', ext: 'aar')
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.android.support:appcompat-v7:23.4.0'
}`

code for MapFragmentView.java:

`package com.here.android.example.routing;

import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.here.android.mpa.common.GeoBoundingBox;
import com.here.android.mpa.common.GeoCoordinate;
import com.here.android.mpa.common.OnEngineInitListener;
import com.here.android.mpa.mapping.Map;
import com.here.android.mpa.mapping.MapFragment;
import com.here.android.mpa.mapping.MapRoute;
import com.here.android.mpa.routing.CoreRouter;
import com.here.android.mpa.routing.RouteOptions;
import com.here.android.mpa.routing.RoutePlan;
import com.here.android.mpa.routing.RouteResult;
import com.here.android.mpa.routing.RouteWaypoint;
import com.here.android.mpa.routing.Router;
import com.here.android.mpa.routing.RoutingError;

import java.io.File;
import java.util.List;

/**

  • This class encapsulates the properties and functionality of the Map view.A route calculation from

  • HERE Burnaby office to Langley BC is also being handled in this class
    */
    public class MapFragmentView {
    private MapFragment m_mapFragment;
    private Button m_createRouteButton;
    private Activity m_activity;
    private Map m_map;
    private MapRoute m_mapRoute;

    public MapFragmentView(Activity activity) {
    m_activity = activity;
    initMapFragment();
    /*
    * We use a button in this example to control the route calculation
    */
    initCreateRouteButton();
    }

    private void initMapFragment() {
    /* Locate the mapFragment UI element */
    m_mapFragment = (MapFragment) m_activity.getFragmentManager()
    .findFragmentById(R.id.mapfragment);

     // Set path of isolated disk cache
     String diskCacheRoot = Environment.getExternalStorageDirectory().getPath()
             + File.separator + ".isolated-here-maps";
     // Retrieve intent name from manifest
     String intentName = "";
     try {
         ApplicationInfo ai = m_activity.getPackageManager().getApplicationInfo(m_activity.getPackageName(), PackageManager.GET_META_DATA);
         Bundle bundle = ai.metaData;
         intentName = bundle.getString("INTENT_NAME");
     } catch (PackageManager.NameNotFoundException e) {
         Log.e(this.getClass().toString(), "Failed to find intent name, NameNotFound: " + e.getMessage());
     }
    
     boolean success = com.here.android.mpa.common.MapSettings.setIsolatedDiskCacheRootPath(diskCacheRoot, intentName);
     if (!success) {
         // Setting the isolated disk cache was not successful, please check if the path is valid and
         // ensure that it does not match the default location
         // (getExternalStorageDirectory()/.here-maps).
         // Also, ensure the provided intent name does not match the default intent name.
         Toast.makeText(m_activity,
                 "ERROR: No success!",
                 Toast.LENGTH_LONG).show();
     } else {
         if (m_mapFragment != null) {
         /* Initialize the MapFragment, results will be given via the called back. */
             m_mapFragment.init( new OnEngineInitListener() {
                 @Override
                 public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
    
                     if (error == Error.NONE) {
                     /* get the map object */
                         m_map = m_mapFragment.getMap();
    
                     /*
                      * Set the map center to the 4350 Still Creek Dr Burnaby BC (no animation).
                      */
                         m_map.setCenter(new GeoCoordinate(49.259149, -123.008555, 0.0),
                                 Map.Animation.NONE);
    
                     /* Set the zoom level to the average between min and max zoom level. */
                         m_map.setZoomLevel((m_map.getMaxZoomLevel() + m_map.getMinZoomLevel()) / 2);
                     } else {
                         Toast.makeText(m_activity,
                                 "ERROR: Cannot initialize Map with error " + error,
                                 Toast.LENGTH_LONG).show();
                     }
                 }
             });
         }
     }
    

    }

    private void initCreateRouteButton() {
    m_createRouteButton = (Button) m_activity.findViewById(R.id.button);

     m_createRouteButton.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
             /*
              * Clear map if previous results are still on map,otherwise proceed to creating
              * route
              */
             if (m_map != null && m_mapRoute != null) {
                 m_map.removeMapObject(m_mapRoute);
                 m_mapRoute = null;
             } else {
                 /*
                  * The route calculation requires local map data.Unless there is pre-downloaded
                  * map data on device by utilizing MapLoader APIs, it's not recommended to
                  * trigger the route calculation immediately after the MapEngine is
                  * initialized.The INSUFFICIENT_MAP_DATA error code may be returned by
                  * CoreRouter in this case.
                  *
                  */
                 createRoute();
             }
         }
     });
    

    }

    /* Creates a route from 4350 Still Creek Dr to Langley BC with highways disallowed /
    private void createRoute() {
    /
    Initialize a CoreRouter */
    CoreRouter coreRouter = new CoreRouter();

     /* Initialize a RoutePlan */
     RoutePlan routePlan = new RoutePlan();
    
     /*
      * Initialize a RouteOption.HERE SDK allow users to define their own parameters for the
      * route calculation,including transport modes,route types and route restrictions etc.Please
      * refer to API doc for full list of APIs
      */
     RouteOptions routeOptions = new RouteOptions();
     /* Other transport modes are also available e.g Pedestrian */
     routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
     /* Disable highway in this route. */
     routeOptions.setHighwaysAllowed(false);
     /* Calculate the shortest route available. */
     routeOptions.setRouteType(RouteOptions.Type.SHORTEST);
     /* Calculate 1 route. */
     routeOptions.setRouteCount(1);
     /* Finally set the route option */
     routePlan.setRouteOptions(routeOptions);
    
     /* Define waypoints for the route */
     /* START: 4350 Still Creek Dr */
     RouteWaypoint startPoint = new RouteWaypoint(new GeoCoordinate(49.259149, -123.008555));
     /* END: Langley BC */
     RouteWaypoint destination = new RouteWaypoint(new GeoCoordinate(49.073640, -122.559549));
    
     /* Add both waypoints to the route plan */
     routePlan.addWaypoint(startPoint);
     routePlan.addWaypoint(destination);
    
     /* Trigger the route calculation,results will be called back via the listener */
     coreRouter.calculateRoute(routePlan,
             new Router.Listener<List<RouteResult>, RoutingError>() {
                 @Override
                 public void onProgress(int i) {
                     /* The calculation progress can be retrieved in this callback. */
                 }
    
                 @Override
                 public void onCalculateRouteFinished(List<RouteResult> routeResults,
                         RoutingError routingError) {
                     /* Calculation is done.Let's handle the result */
                     if (routingError == RoutingError.NONE) {
                         if (routeResults.get(0).getRoute() != null) {
                             /* Create a MapRoute so that it can be placed on the map */
                             m_mapRoute = new MapRoute(routeResults.get(0).getRoute());
    
                             /* Show the maneuver number on top of the route */
                             m_mapRoute.setManeuverNumberVisible(true);
    
                             /* Add the MapRoute to the map */
                             m_map.addMapObject(m_mapRoute);
    
                             /*
                              * We may also want to make sure the map view is orientated properly
                              * so the entire route can be easily seen.
                              */
                             GeoBoundingBox gbb = routeResults.get(0).getRoute()
                                     .getBoundingBox();
                             m_map.zoomTo(gbb, Map.Animation.NONE,
                                     Map.MOVE_PRESERVE_ORIENTATION);
                         } else {
                             Toast.makeText(m_activity,
                                     "Error:route results returned is not valid",
                                     Toast.LENGTH_LONG).show();
                         }
                     } else {
                         Toast.makeText(m_activity,
                                 "Error:route calculation returned error code: " + routingError,
                                 Toast.LENGTH_LONG).show();
                     }
                 }
             });
    

    }
    }`

I am frustrated as I don't see any error here. Any help will be appreciated:)

turn by turn position delay

Hi @sschuberth ,

I noticed that there is a delay regarding the position shown on the map during navigation. In the turn-by-turn example versus using the HEREWeGo app, the position in the example is always about 10 m behind.
Can you please offer some advice for how to correct this?

Thanks,
Alex

m_map.setZoomLevel()

m_map.setCenter(new GeoCoordinate(45.519914, -73.852406), Map.Animation.LINEAR);
//m_map.setZoomLevel(13.2);
the line in your source code set the center of the map view on this latitude and longitude very nicely if the second line is commented out

if I remove the comment on the second line, the code becomes
m_map.setCenter(new GeoCoordinate(45.519914, -73.852406), Map.Animation.LINEAR);
m_map.setZoomLevel(13.2);
map will center on Germany, not on the latitude and longitude

onPositionUpdated calling is not frequent like before

We have recently updated Here SDK in our app, and looks like we are getting less frequent onPositionUpdated call. In an older version of SDK we used to get more frequent onPositionUpdated method calls. For me, previous time interval between two call was around 300 ms, which is now 1500 ms in an average. I changed nothing , just the SDK. Any idea or solution?

show HereMaps inside an android Linear Layout

Is there anyway to show HereMaps inside a Linear Layout?
This is my layout file and I want to show map in firstMap (LinearLayout).

`

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.apploft.tabs.MyTabFragment">
<RelativeLayout
    android:id="@+id/confirmed"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/firstMap"
        android:layout_width="match_parent"
        android:layout_height="130dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="10dp"
        android:background="@color/cardview_shadow_start_color"
        android:orientation="horizontal">
        <!-- Map Fragment embedded with the map object -->
    </LinearLayout>

</FrameLayout>
`

Android 8 Oreo compability (background limitation for location updates)

Will be any support to prevent location update limitations ?
currently when app is on background or screen is off here premium sdk cannot receive location updates.

Background Location Limits

https://developer.android.com/about/versions/oreo/background-location-limits.html
In an effort to reduce power consumption, Android 8.0 (API level 26) limits how frequently background apps can retrieve the user's current location. Apps can receive location updates only a few times each hour.

There is a suggestion to prevent os limitations

Start a foreground service in your app by calling startForegroundService(). When such a foreground service is active, it appears as an ongoing notification in the notification area.

Error: Cannot initalize map libraries_missing

Hei,
I have this error on my emulator. I use the emulators from Android Studio, but is not working on any of them. I mention that i added the library from here in the libs folder.
Can you help me with that?
thanks :)

global.Here.Map.Service.v2 problems

global.Here.Map.Service.v2 executes a private class of our application, and fails at the line
binder = (GPSService.LocalBinder) gpsBinder;

   private class GPSServiceConnection implements ServiceConnection {

        @Override
        public void onServiceConnected(ComponentName className, IBinder gpsBinder) {
             GPSService.LocalBinder binder = (GPSService.LocalBinder) gpsBinder;

06-23 22:33:54.310 9044-9044/global.Here.Map.Service.v2 W/Config: COLLECTOR - Address: gps.operasoft.ca, Port: 33191
06-23 22:33:55.040 9044-9044/global.Here.Map.Service.v2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: global.Here.Map.Service.v2, PID: 9044
java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.operasoft.android.gps.services.GPSService$LocalBinder
at ca.operasoft.simpli.SimpliApplication$GPSServiceConnection.onServiceConnected(SimpliApplication.java:105)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1335)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1352)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7230)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Getting error on adding service in AndroidManifest.xml file

Hi,

I am getting error while adding service in Manifest file. My service name is "android:name="com.here.android.mpa.service.MapService" as shown in HERE-API documents. But I am getting error of Unresolved package name.

Can someone please help me.

Thanks,
Nidhi

turn by turn navigation missing proper map scheme

I'm trying this turn by turn navigation example https://github.com/heremaps/here-android-sdk-examples/tree/master/turn-by-turn-navigation-android, and I keep getting error toast Error:route calculation returned error code: ROUTE_CORRUPTED after looking at the documentation, it was fixed by adding one line m_map.setMapScheme(Map.Scheme.CARNAV_DAY); to MapFragmentView https://github.com/heremaps/here-android-sdk-examples/blob/master/turn-by-turn-navigation-android/app/src/main/java/com/here/android/example/guidance/MapFragmentView.java

OPERATION_NOT_ALLOWED error even after app id is updated in manifest file

Hi,
I have installed most of the android samples available in the repository. I have changed the app id and other license related keys in Manifest file, I end up with Map not initialised error, error is OPERATION_NOT_ALLOWED. All but one which I have mentioned below, fail with Map not initialised error.

Could you please let me know if I am missing something? I have installed the Basic Map Solution app running on my device and it runs without any error. I am using a Google pixel device running Android 7.1.1

Regards,
Bharat

voice navigation

I wrote a section of code for voice android navigation, but it is not working
could you send me (or point me to ) a section of code to turn on voice navigation ?
I need English, French and Spanish in tts

No implementation found for boolean com.nokia.maps.MapsEngine.setAppCredentials_native

FATAL EXCEPTION: main
Process: com.internation.ligo, PID: 7105
java.lang.UnsatisfiedLinkError: No implementation found for boolean com.nokia.maps.MapsEngine.setAppCredentials_native(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int) (tried Java_com_nokia_maps_MapsEngine_setAppCredentials_1native and Java_com_nokia_maps_MapsEngine_setAppCredentials_1native__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2I)
at com.nokia.maps.MapsEngine.setAppCredentials_native(Native Method)
at com.nokia.maps.MapsEngine.e(MapsEngine.java:688)
at com.nokia.maps.MapsEngine.a(MapsEngine.java:476)
at com.nokia.maps.MapsEngine.a(MapsEngine.java:364)
at com.here.android.mpa.common.MapEngine.init(MapEngine.java:260)
at com.nokia.maps.bw.a(MapFragmentImpl.java:131)
at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:112)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Suppressed: java.lang.Throwable: HERE SDK Version: 3.5.0.466
at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

navigation issue

[
app
heremaps
gmaps

](url)

Hi,

I have encountered an issue with the Android SDK routePlan. The route suggested by our app differs form the one sugested by the Here App, here maps web app, and google maps. I am not sure what the issue is, but maybe you can offer some support on this. There is a an error of a few meters on the coordinates in the app, but the HERE web app is reverse geocoding the coordinates so maybe that's why it works correctly. I have included the screenshots.

Thanks,
Alex

Get unknown error while initializing map engine

Recently, I developed map feature with your android premium SDK, and things were going well. But somedays ago, it threw Native engine initialization failed for unknown reason while the MapEngine was initializing. And it cannot initial anymore.
To check what's going wrong, I also download your example project and run it, but the error is still there. I cannot find solution from stackoverflow, so I hope you can help me to solve this.

My test phone is Redmi Note 4 with Android 6.0 and Nextbit Robin with Android 7.0, both device get same exception.
here's initializing code from turn-by-turn navigation sample project:

private void initMapFragment() {
        m_mapFragment = (MapFragment) m_activity.getFragmentManager()
                .findFragmentById(R.id.mapfragment);

        if (m_mapFragment != null) {
            m_mapFragment.init(new OnEngineInitListener() {
                @Override
                public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {

                    if (error == Error.NONE) {
                        m_map = m_mapFragment.getMap();
                        m_map.setCenter(new GeoCoordinate(49.259149, -123.008555),
                                Map.Animation.LINEAR);
                        m_map.setZoomLevel(13.2);

                        m_navigationManager = NavigationManager.getInstance();
                    } else {
                        Toast.makeText(m_activity,
                                "ERROR: Cannot initialize Map with error " + error,
                                Toast.LENGTH_LONG).show();
                        Log.e("MapFragmentView", error.getDetails(), error.getThrowable());
                    }
                }
            });
        }

    }

and here's my log:

05-18 11:39:44.275 12031-12031/com.here.android.example.guidance E/MapFragmentView: Native engine initialization failed for unknown reason.
                                                                                    java.lang.Throwable
                                                                                        at com.nokia.maps.av.a(EngineError.java:27)
                                                                                        at com.nokia.maps.MapsEngine$j.a(MapsEngine.java:764)
                                                                                        at com.nokia.maps.MapsEngine$j.a(MapsEngine.java:650)
                                                                                        at com.nokia.maps.MapsEngine$j.doInBackground(MapsEngine.java:634)
                                                                                        at android.os.AsyncTask$2.call(AsyncTask.java:304)
                                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                                        at java.lang.Thread.run(Thread.java:761)

Route Corrupted error

I faced a route corrupted error while using the same lat lng.
Here's the code

 CoreRouter coreRouter = new CoreRouter();

        /* Initialize a RoutePlan */
        RoutePlan routePlan = new RoutePlan();

        /*
         * Initialize a RouteOption.HERE SDK allow users to define their own parameters for the
         * route calculation,including transport modes,route types and route restrictions etc.Please
         * refer to API doc for full list of APIs
         */
        RouteOptions routeOptions = new RouteOptions();
        /* Other transport modes are also available e.g Pedestrian */
        routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
        /* Disable highway in this route. */
        routeOptions.setHighwaysAllowed(false);
        /* Calculate the shortest route available. */
        routeOptions.setRouteType(RouteOptions.Type.SHORTEST);
        /* Calculate 1 route. */
        routeOptions.setRouteCount(1);
        /* Finally set the route option */
        routePlan.setRouteOptions(routeOptions);

        /* Define waypoints for the route */
        /* START: 4350 Still Creek Dr */
        RouteWaypoint startPoint = new RouteWaypoint(new GeoCoordinate(49.259149, -123.008555));
        /* END: Langley BC */
        RouteWaypoint destination = new RouteWaypoint(new GeoCoordinate(49.073640, -122.559549));

        /* Add both waypoints to the route plan */
        routePlan.addWaypoint(startPoint);
        routePlan.addWaypoint(destination);

        /* Trigger the route calculation,results will be called back via the listener */
        coreRouter.calculateRoute(routePlan,
                new Router.Listener<List<RouteResult>, RoutingError>() {

                    @Override
                    public void onProgress(int i) {
                        /* The calculation progress can be retrieved in this callback. */
                    }

                    @Override
                    public void onCalculateRouteFinished(List<RouteResult> routeResults,
                            RoutingError routingError) {
                        /* Calculation is done.Let's handle the result */
                        if (routingError == RoutingError.NONE) {
                            if (routeResults.get(0).getRoute() != null) {

                                m_route = routeResults.get(0).getRoute();
                                /* Create a MapRoute so that it can be placed on the map */
                                MapRoute mapRoute = new MapRoute(routeResults.get(0).getRoute());

                                /* Show the maneuver number on top of the route */
                                mapRoute.setManeuverNumberVisible(true);

                                /* Add the MapRoute to the map */
                                m_map.addMapObject(mapRoute);

                                /*
                                 * We may also want to make sure the map view is orientated properly
                                 * so the entire route can be easily seen.
                                 */
                                m_geoBoundingBox = routeResults.get(0).getRoute().getBoundingBox();
                                m_map.zoomTo(m_geoBoundingBox, Map.Animation.NONE,
                                        Map.MOVE_PRESERVE_ORIENTATION);

                                startNavigation(m_route);
                            } else {
                                Toast.makeText(m_activity,
                                        "Error:route results returned is not valid",
                                        Toast.LENGTH_LONG).show();
                            }
                        } else {
                            Toast.makeText(m_activity,
                                    "Error:route calculation returned error code: " + routingError,
                                    Toast.LENGTH_LONG).show();

                        }
                    }
                });

Getting NETWORK_COMMUNICATION error

I clone the sample project and modify it as said in tutorial guide but when i run app on mobile and press Get direction it returns NETWORK_COMMUNICATION error in onCalculateRouteFinished method.

Help me to resolve this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.