Create a itenerary for Sygic with PhoneGap (iOS)

296 Views Asked by At

researching earlier posts I know am trying to create a predefined route into Sygic via it's custom URL scheme. The basics work. I added this command in my very basic PhoneGap:

<a href="com.sygic.aura://coordinate|5.6784149|52.8759607|drive">

This opens the app and starts the route calculation. Yeah!! Step one completed ;)

Now I want to add a via point. The Sygic site gives me 2 options, but how to implement these inside my phonegap? Any help is appreciated

1: C#

NavigateToItinerary("Itinerary1");

void NavigateToItinerary(string strName)
{
SError err;
int flags = 0;
bool bShowApplication = true;
int maxTime = 0;

SStopOffPoint[] points = new SStopOffPoint[3]; //an array of SStopOffPoint

points[0] = new SStopOffPoint();        //initialization
points[0].Location.lX = 1341555;        //GPS position, x-coordinate multiplied by 100 000
points[0].Location.lY = 5252462;        //GPS position, y-coordinate multiplied by 100 000
points[0].nPointType = 3;               //type 3 = start
points[0].SetCaption("Starting point"); //caption

points[1] = new SStopOffPoint();
points[1].Location.lX = 1340753;
points[1].Location.lY = 5252390;
points[1].nPointType = 2;               // type 2 = finish point
points[1].SetCaption("Finish point");

points[2] = new SStopOffPoint();
points[2].Location.lX = 1340780;
points[2].Location.lY = 5251871;
points[2].nPointType = 1;                //type = 1 for visible waypoint, 4 for invisible waypoint
points[2].SetCaption("Via Point");

int ret = CApplicationAPI.AddItinerary(out err, points, strName, maxTime); //API function for adding itinerary
if (ret == 1)
    Debug.WriteLine("Itinerary created successfully.");

ret = CApplicationAPI.SetRoute(out err, strName, flags, bShowApplication, maxTime);
if (ret == 1)
    Debug.WriteLine("Routing finished successfully.");
}

Or 2: Java

import com.sygic.sdk.remoteapi.Api;
import com.sygic.sdk.remoteapi.ApiItinerary;
import com.sygic.sdk.remoteapi.exception.GeneralException;
import com.sygic.sdk.remoteapi.model.StopOffPoint;
...
try {
String strItineraryName = "Itinerary1"; //itinerary name
int MaxTime = 0;
int flags = 0;
ArrayList<StopOffPoint> PointArr = new ArrayList<StopOffPoint>();
PointArr.add(new StopOffPoint(false, false, StopOffPoint.PointType.START, 1710726, 4814623, -1, 0, "", "ba", ""));
PointArr.add(new StopOffPoint(false, false, StopOffPoint.PointType.VIAPOINT, 1739716, 4821671, -1, 0, "", "senec", ""));
PointArr.add(new StopOffPoint(false, false, StopOffPoint.PointType.FINISH, 1759511, 4837351, -1, 0, "", "trnava", ""));
ApiItinerary.addItinerary(PointArr, strItineraryName, MaxTime);
ApiItinerary.setRoute(strItineraryName, flags, MaxTime);
} catch (GeneralException e) {
Log.e("Itinerary", "Error code:"+ e.getCode());
}
0

There are 0 best solutions below