Opening geo location through html (not Intents)

// Expert user has replied.
N Nick ter Horst 2 years 11 months ago
2 2 0

This is working through an Intents action, but some suggested it should be possible in a shorter way:

Send textmessagezzz).
Strange part is when you surf to http://en.wikipedia.org/wiki/Geo_URI and open one of the example links, it gives a program-choser to open the location!

Am i forgetting something or is it only possible through Intents?

Please register or login to post a reply

2 Replies

J Jon Tara

If it works on your device, you can use it. It's no different having your app use that URI than using it on the system browser.

It will depend on OS and what application(s) are installed on the user's device, though. And it may depend on what version of OS.

Most/all mobile OS have some URI scheme(s) for opening local apps. This pre-dates intents, which are specific to Android. Nobody else but Android has Intents, but other OSs can have something similar. (iOS recently only has something similar.)

Rhodes does something to fake Intents on other platforms, but only between different Rhodes-based applications - it can only use intents for non-Rhodes apps on Android, because it is the only OS that really has them. But maybe Rhodes will eventually have some emulation layer above the equivalent of intents in other OSs.

You have to study each one to see what is supported. Geo URI is an open standard, and is supported by current versions of iOS and Android. Maybe not for older OS.

On my iPhone, the first example opens Google Earth.

On my Samsung Galaxy Tab 2, the first example opens Google Maps.

I wasn't offered any kind of chooser in either case.

R Robert Galvin

The chooser on Android comes up when you have multiple applications registered to receive that intent. So if you installed another app like Waze or something else that can handle mapping, then you may see the chooser. Keep in mind that once you get the chooser and tap 'Always' you will not see the chooser any longer.

If you are using AngularJS they have URL whitelisting capabilities that may be killing your link. If you use webinspector you would see the hrefs automatically changed to start with 'unsafe', so your link will not work. It can be bypassed by using the $compileProvider

angular.module('myModule', [], function ($compileProvider) {

  $compileProvider.urlSanitizationWhitelist(/^\s*(https?|geo|mailto|maps):/);

});

I have found that the geo: URI works more consistently on Android then in iOS, but has been around for sometime and should really work without much effort.

CONTACT
Can’t find what you’re looking for?