send geo intent instead of gmaps intent on maps link click

This commit is contained in:
Philipp Schaefer 2013-04-27 00:08:28 +02:00
parent 488b68df2e
commit a208ba9083
2 changed files with 6 additions and 4 deletions

View File

@ -136,7 +136,7 @@ window.showPortalPosLinks = function(lat, lng, name) {
portal_name = encodeURIComponent(' (' + name + ')'); portal_name = encodeURIComponent(' (' + name + ')');
} }
if (typeof android !== 'undefined' && android && android.intentPosLink) { if (typeof android !== 'undefined' && android && android.intentPosLink) {
android.intentPosLink(window.location.protocol + '//maps.google.com/?q='+lat+','+lng); android.intentPosLink(lat, lng);
} else { } else {
var qrcode = '<div id="qrcode"></div>'; var qrcode = '<div id="qrcode"></div>';
var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>'; var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>';

View File

@ -18,11 +18,13 @@ public class IITC_JSInterface {
context = c; context = c;
} }
// send intent for gmaps link // send geo intent for navigation apps like gmaps or waze etc...
@JavascriptInterface @JavascriptInterface
public void intentPosLink(String s) { public void intentPosLink(String lat, String lng) {
// TODO eventually we want back our lat/lng-query? + "?q=" + lat + "," + lng;
String uri = "geo:" + lat + "," + lng;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(s)); Uri.parse(uri));
context.startActivity(intent); context.startActivity(intent);
} }