Question

I have integrated sygic in my android application using a surface view. I want to navigate in that sygic application . I have used this code :

SWayPoint wp = new SWayPoint();
wp.Location = new LONGPOSITION(34, 35);
ApplicationAPI.StartNavigation(err, wp, 0, true, false, MAX);

But it is not working. Any ideas ?

Was it helpful?

Solution

I have once implemented Sygic in an app and this is basically how my code looks like (after hours of debug because the documentation was very poor...):

// surfaceView for displaying the "map"
SurfaceView mSygicSurface = (SurfaceView) findViewById(R.id.sygic_surface); // surface

// api status
int mSygicAPIStatus = -2;

// start the drive
ApplicationAPI.startDrive(new ApiCallback() {
    public void onRunDrive() {
        mSygicSurface.post(new Runnable() {
            public void run() {
                runDrive(mSygicSurface, getPackageName());
            }
        });
    }

    public void onInitApi() // gets called after runDrive();
    {
        mSygicAPIStatus = ApplicationAPI.InitApi(getPackageName(), true, new ApplicationHandler() { /* nothing relevant here */ }); // api initialization

        if (mSygicAPIStatus != 1) {
            // error
            return;
        }
    }
});

Once you want to navigate somewhere:

GeoPoint point = new GeoPoint(/* ... */, /* ... */);
final SWayPoint wayPoint = new SWayPoint("", point.getLongitudeE6(), point.getLatitudeE6());
SError error = new SError();
final int returnCode = ApplicationAPI.StartNavigation(error, point, NavigationParams.NpMessageAvoidTollRoadsUnable, true, true, 0);

Carefully note that Sygic uses E6 coordinates.

OTHER TIPS

This is not an answer on the question, but for whose who searching for weird sygic exmaples in 2017 I put it here

  ApiMaps.showCoordinatesOnMap(new Position((int)(-84.41949*100000.0),(int)(33.7455*100000.0)),1000,0); 
  //LONGITUDE first!!
  //and multiply on 100 000

//https://developers.sygic.com/reference/java3d/html/classcom_1_1sygic_1_1sdk_1_1remoteapi_1_1_api_maps.html

p.s. this is for standalone apk

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top