How can I integrate a navigator app on a device

What is the best approach to make use of navigation features like route planning when I have an address in my Movelet and want to trigger a navigation via an external app on iOS, Android and Windwos Phone?

Upvotes: 1

Views: 316

Answers (3)

Praneesh
Praneesh

Reputation: 373

For the navigation on Android, the following worked for me.

intentURL = '%com.google.android.apps.maps%google.navigation:q=Address';
conID = connect(concat('exec:', intentURL), "name");
if (conID ?ge 0) 
{
     close(conID);
}

Address could be: RMZ Eco World Rd, Adarsh Palm Retreat Villas, Bellandur, Bengaluru, Karnataka 560103, India 

Upvotes: 1

Aleq
Aleq

Reputation: 94

I've also found another way on Android:

addressTxt = "Wenceslas Square, Prague, CZ";
connStr    = concat("exec://", "%com.google.android.apps.maps%", "http://maps.google.com/maps?daddr=", addressTxt);
connection = connect(connStr, "name");
try
{
    close(connection);
}
catch (exception)
{
}

Result on YouTube

Upvotes: 1

lrs_coolik
lrs_coolik

Reputation: 81

To jump into another app you need the Movilizer AppJump feature, with this you can open a connection (Module SPI) and trigger the execution in use of the exec command. What you or the user still has to do is to start the navigation manually by pressing the Start button in the maps app.

For the Android Client you need to use the protocol named geo. Geo gives you two opportunities, you can either enter the specific coordinates or enter an address.

The use of specific coords will look like this:

'geo:49.483611111111,8.463055555555697?z=18'

In case you don't know the coords you can also use:

'geo:0,0?q=Wilhelm-Varnholt-Allee 1, 68165 Mannheim?z=18'

In your code it will look like that:

if(platform == 11)
{
    intentURL = conCat('geo:0,0?q=', destPoint,'?z=18'); 
    conStr = conCat('exec:', intentURL);
}

For the iOS Client the URL scheme looks quite similar, but instead of using geo you need to use to point on the app which you want to open.

'exec:maps://?q=Wilhelm-Varnholt-Allee 1, 68165 Mannheim?z=18'

The use of maps:// will open the Apple Maps app if you want to have Google Maps you must use comgooglemaps://

I've prepared a small example this may helps you to solve the problem you have:

<question key="#1" type="6" title="Address">
<answer key="#1_0" nextQuestionKey="END" dummyAnswer="true"/>
<onEnterAssignment>

addresses = 
{
    'Diakoniekrankenhaus Mannheim' : 'Speyerer Str. 91, 68163 Mannheim';
    'Moll-Gymnasium' : 'Feldbergstraße 16, 68163 Mannheim';
    'Planetarium Mannheim' : 'Wilhelm-Varnholt-Allee 1, 68165 Mannheim';
    'Karl Benz Stadion' : 'Theodor-Heuss-Anlage 20, 68165 Mannheim';
    'Luisenpark' : 'Theodor-Heuss-Anlage 2, 68165 Mannheim';
    'Mannheim City Airport':'Seckenheimer Landstr.172, 68163 Mannheim';
};

for(dest:addresses)
{
    addAnswer($answer:'#1_0', dest, dest);
}

platform = getClientType();
</onEnterAssignment>  
<onLeaveOkPersistAssignment>
destPoint = addresses[getQuestionValue()];
if(platform == 11)
{
    intentURL = conCat('geo:0,0?q=', destPoint,'?z=18'); 
    conStr = conCat('exec:', intentURL);
}
else
{
    conStr = conCat('exec:maps://?q=', destPoint, '?z=18');

}

conID = connect(conStr, null);

if(isConnectionOpen(conID))
{
    close(conID);
}
</onLeaveOkPersistAssignment>

Upvotes: 3

Related Questions