3 Replies Latest reply on Feb 23, 2015 10:00 AM by Jon Tara

    Opening geo location through html (not Intents)

    Nick ter Horst

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

       

      <a href="geo:12,45>Somewhere special?</a>

       

      This is working for Text Messaging and email etc (<a href="sms:+31612345678?body=textMessagezzz>Send textmessagezzz</a>).

      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?

        • Re: Opening geo location through html (not Intents)
          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.

          • Re: Opening geo location through html (not Intents)
            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.