geo: URL?

3,675 views
Skip to first unread message

Paul Libbrecht

unread,
Aug 4, 2012, 12:24:00 PM8/4/12
to osm...@googlegroups.com
Dear OSMand experts,

I'm a happy user of OSMand, although I still need Google Maps to search things from time to time, I'm happy to stick OSMand real well.

One feature I am sorrowly missing, actually of any navigation system, is a way to share places.

Sure, I can craft a web-service that would store and sync my favorites from OSMand up and down, and to a web-service... but maybe even simpler would the usage of the geo protocol.

It appears that an RFC has been made at http://www.rfc-editor.org/rfc/rfc5870.txt which documents a way to write locations as a URL. If this was well supported I could simply send me by mail a few places of interest using a link, e.g.  geo:48.2010,16.3695,183 and I could open K9 mail click on it, and it's open on OSMand (or maps or...).

There's a lot of different applications.
For example, I've never found, except maybe that one, a *standard* way for a shop to display a web-page that contains a link to their location.

How hard is it?
Maybe the remains of java inside Android can support this (protocol handling has always been fairly hairy on java.net, but maybe Android has made that better?).
Maybe there's a kind of "old registry" just like there is such a thing for http and ftp on desktop platforms?

Or maybe I'm just missing an obvious function.

thanks for hints.

Paul

Onkar Shinde

unread,
Aug 4, 2012, 12:41:02 PM8/4/12
to osm...@googlegroups.com
If select any location in OsmAnd (either by simply click + hold an point of a POI on map screen) and then click that location, you get a menu with option 'Share Location'. Try it. I think this comes pretty close to what you are looking for. or did I misunderstood your question?

Cheers,
Onkar

Rahul Maindargi

unread,
Aug 4, 2012, 2:37:09 PM8/4/12
to osm...@googlegroups.com
I think what he is talking about is intent....  
Like if I have location as address in my contacts or   geo:48.2010,16.3695,183   in SMS... when we click on it we get a nice pop up about asking which application to use like Maps or Waze.... (available map applications) but it does misses our OSMAND... 

I guess the functionality was intentionally left behind as it forces the use of contact/sms read permission... however we can expect to see some plugins similar to Parking plugin which will enable functionality by granting access for those like me who need it :) ....

I tried to look/develop the plugin for contacts as a beginning ... but yet no success at all...  I am very newbie to Android so doesn't understand Intents much... I am not sure.. if I need to write a intent or register it (something like intent Listener) to contact intent...  but searching... any help appreciated...  

Paul Libbrecht

unread,
Aug 4, 2012, 4:11:36 PM8/4/12
to osm...@googlegroups.com
Thanks Onkar,

If select any location in OsmAnd (either by simply click + hold an point of a POI on map screen) and then click that location, you get a menu with option 'Share Location'. Try it. I think this comes pretty close to what you are looking for. or did I misunderstood your question?

well, more or less.
I tried it and obtained:
Pour voir ce lieu, suivre le lien web http://osm.org/go/0DSq4XoTV--?m ou android http://download.osmand.net/go?lat=49.245594&lon=7.011702&z=18

It does work as a way out of OsmAnd, a somewhat limited one (e.g. it fails to go to Google Maps or many others).

What would be the way to go from, say, OpenStreetMap.org to OSMand?
What would be the way to go from a shop page to OSMand? Many people put a Google Maps URL... but that is application specific. A link such as one of the above is, again, application specific.

paul


Gints Polis

unread,
Aug 5, 2012, 1:05:26 AM8/5/12
to osm...@googlegroups.com

If I get posibilty to store in contacts position and later use it from there... I would be so happy... :-)

Gints

Victor Shcherb

unread,
Aug 5, 2012, 5:30:38 AM8/5/12
to osm...@googlegroups.com
Geo intent is already supported https://github.com/osmandapp/Osmand/blob/master/OsmAnd/AndroidManifest.xml#L63

воскресенье, 5 августа 2012 г. пользователь Gints Polis писал:

Gints Polis

unread,
Aug 5, 2012, 7:04:27 AM8/5/12
to osm...@googlegroups.com

How about store position in contacts?

Paul Libbrecht

unread,
Aug 5, 2012, 7:36:01 AM8/5/12
to osm...@googlegroups.com
Victor,

this looks like good news!

So... would it give the ability to click on a geo URL?
Right now it is not present even though that line seems to be from 18th of January 2011.
I just tested again on a freshly installed IceCreamSandwich and could not see a geo URL as being, at least, highlighted in K9-mail.

What's missing?

paul

flo

unread,
Aug 5, 2012, 8:08:49 AM8/5/12
to osm...@googlegroups.com
maybe K9 doesn't recognize geo-uris as clickable links?

category 'browsable' is needed for arbitrary websites in the browser
because otherwise unknown sources could inject anything. after making
sure to sanitize uri-parameters, your app has to explicitly allow
website-links

Paul Libbrecht

unread,
Aug 5, 2012, 8:20:26 AM8/5/12
to osm...@googlegroups.com
Thank you flo,

indeed, with Firefox on my Android, the link in the page below:
http://direct.hoplahup.net/tmp/geoattempt.html
when clicked, requested me to open in an application and asked me which application, I had DB-navigator (the train schedule thing), (Google) Maps, and OSMand, and the latter took me, as expected, to a place close the Donau.

Nonetheless "category browsable" is a bit of chinese for me.

In particular since from the Internet Browser app, I was only offered DB-Navigator and Maps, and not OSMand!!

paul

Flo

unread,
Aug 5, 2012, 12:28:00 PM8/5/12
to osm...@googlegroups.com
opening apps with url-parameters that come from unknown sources
(arbitrary websites) poses a security risk, since unwanted "things"
could be injected. This is why the android standard browser does only
launch apps that explicitly declare that they are ok with that. This
is done by adding the category 'browsable' to the intent filter in the
manifest.
http://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE
Hope that clarifies.
Apparently firefox does not support this security feature. That's interesting!

Paul Libbrecht

unread,
Aug 5, 2012, 2:26:43 PM8/5/12
to osm...@googlegroups.com

Le 5 août 2012 à 18:28, Flo a écrit :

> opening apps with url-parameters that come from unknown sources
> (arbitrary websites) poses a security risk, since unwanted "things"
> could be injected.

That's normal and OSMand doesn't treat them in any way trusted.
Opening an http URL is dangerous and browsers know it also.

> This is why the android standard browser does only launch apps that explicitly declare that they are ok with that. This is done by adding the category 'browsable' to the intent filter in the
> manifest.

Mmmh, that seems quite far from an applicable user-interface action, or do I mistake?

Is there a way to make the Android standard browser (that's more the OS, right?) declare that there is no danger into opening such a URL?

> http://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE
> Hope that clarifies.
> Apparently firefox does not support this security feature. That's interesting!

Funnily, to my taste, in the case of this protocol, I do not see any risk.

paul

Paul Libbrecht

unread,
Aug 12, 2012, 9:42:06 AM8/12/12
to osm...@googlegroups.com
Hello OSMand community,

Allow me to insist here as I do not see a proper solution currently.

What is left so that OSMand, for anyone that installs it, is recognized as a safe tool to open geo URLs?


Thus far I only see that it is possible with Firefox and that it is considered a security hole (so is likely to be closed soon).

Is there no way for OSMand makers to declare somewhere that its intent to open geo URLs will not endanger the user and thus it is ok to be proposed to the users as well?

thanks in advance

Paul

Rahul Maindargi

unread,
Aug 29, 2012, 4:26:30 AM8/29/12
to osm...@googlegroups.com
I guess this is what we can do to get it working on ICS 

<intent-filter>
           
<action android:name="android.intent.action.VIEW" />
           
<category android:name="android.intent.category.DEFAULT" />
           
<data android:mimeType="vnd.android.cursor.item/*" android:host="com.android.contacts" android:pathPrefix="/data" android:scheme="content"/>
       
</intent-filter>
OR 


The solution, provided by Google Developer Relations is:

<intent-filter android:label="MyApp">
   
<action android:name="android.intent.action.VIEW" />
   
<category android:name="android.intent.category.DEFAULT" />
   
<data android:mimeType="vnd.android.cursor.item/postal-address_v2" />
</intent-filter>

Source 
and 

Rahul Maindargi

unread,
Aug 29, 2012, 7:13:03 AM8/29/12
to osm...@googlegroups.com
Created Pull request   https://github.com/osmandapp/Osmand/pull/300   with solution suggested by google developer. 

Rahul Maindargi

unread,
Aug 29, 2012, 11:15:30 AM8/29/12
to osm...@googlegroups.com
I am so sorry... Please discard the above Pull request. 

It needs contact read permission. 
I created the pull request very fast...without testing. 

Currently I am writing the Plugin with Contact read permission and testing it... 

Please help me how can I share it with you so that you can use it in Android Market as Free... plugin just like parking plugin. 

Onkar Shinde

unread,
Aug 29, 2012, 1:17:14 PM8/29/12
to osm...@googlegroups.com
On Wednesday, 29 August 2012 20:45:31 UTC+5:30, Rahul Maindargi wrote:
I am so sorry... Please discard the above Pull request. 

It needs contact read permission. 
I created the pull request very fast...without testing. 

Currently I am writing the Plugin with Contact read permission and testing it... 

Please help me how can I share it with you so that you can use it in Android Market as Free... plugin just like parking plugin. 

What does your code exactly do? Does it read 'geo:' URLs or does it read address from contact to search it in OsmAnd?

Paul Libbrecht

unread,
Aug 29, 2012, 1:19:56 PM8/29/12
to osm...@googlegroups.com
Rahul,

I do not think that we do need the contacts read permission to open a geo: URL!

Just as the web-page example.com does not need any permission from example.net to make a link on http://example.com/page1.html to http://example.org/page2.html
I think a better test would be to try the (default) browser with that manifest on OsmAnd and see if a geo: URL triggers, at a touch, the suggestion to open OsmAnd aside of Maps to go to that place.

Paul

Sabra Sharaya

unread,
Aug 29, 2012, 1:49:51 PM8/29/12
to osm...@googlegroups.com
I think the permission might be required. I have seen an app fail to display pictures embedded in text messages because it did not have permission to read text messages. It seems the text messaging app cannot launch another app and transfer the data without this permission.

Rahul Maindargi

unread,
Aug 29, 2012, 2:23:39 PM8/29/12
to osm...@googlegroups.com
 Let me explain ... 
with those changes the intent data (uri) we get is not "geo uri" the "Uri" we get is "content://com.android.contacts/data/5" 
 
We need below code to read the actual address value...
 
Cursor cur=getContentResolver().query(intent.getData(),null,null,null,null);
if (cur.moveToFirst() == false)
{
   //no rows empty cursor
   return;
}
final String address= cur.getString(cur.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS));


getContentResolver().query(intent.getData(),null,null,null,null);   Needs the Contact Read permission.  


I have created the a separate plugin with Contact read permission and and it initiates the OSMAND with geo URL... so OSMAND wont need Contact Permission... 

I will update the plugin in different thread for use... and I wish to share the code too... but dont know how to add it to OSMAND resporatory...  a seperate plugin project... 


Rahul Maindargi

unread,
Sep 2, 2012, 6:05:43 AM9/2/12
to osm...@googlegroups.com

 The Source code is uploaded at  https://github.com/rahulmaindargi/Osmand-ContactAddressPlugin 

Philip Gillißen

unread,
Sep 3, 2012, 7:58:16 AM9/3/12
to osm...@googlegroups.com
Hi Rahul!

2012/9/2 Rahul Maindargi <rahulma...@gmail.com>
Thanks for the work!
One comment: It's always nice to have a README file in your repository. GitHub will automatically parse the README (even with Markdown syntax). This will help users to see, what this plugin will do.
My proposal: Link to this mailing list thread and give some general information about the plugin.
This will help the users using this plugin.

Kind regards,
Philip 

Hamed SH

unread,
Sep 3, 2012, 11:06:55 AM9/3/12
to osm...@googlegroups.com

good idea Rahul!

Rahul Maindargi

unread,
Sep 3, 2012, 11:37:25 AM9/3/12
to osm...@googlegroups.com
Thanks for suggestion.... 
I am really new to Github (and to tell the truth Android development too..).  

So as  I understand these suggestions
1.  I will create a readme file and push it to github...  
2. Where can I specify link to this thread on Github?  inside read me... 

Sorry for such basic questions... but already a lot confused about branching,push and pull... 

Paul Libbrecht

unread,
Sep 3, 2012, 11:42:00 AM9/3/12
to osm...@googlegroups.com
Rahul,

your readme should just follow the Markdown syntax:
Put it anywhere in the readme.
Paul

Philip Gillißen

unread,
Sep 3, 2012, 12:58:48 PM9/3/12
to osm...@googlegroups.com
Hi Rahul!

Am 03.09.2012 17:37, schrieb Rahul Maindargi:
> So as I understand these suggestions
> 1. I will create a readme file and push it to github...
> 2. Where can I specify link to this thread on Github? inside read me...
>
> Sorry for such basic questions... but already a lot confused about
> branching,push and pull...

Don't worry, that's what nice internet folks are here for!

I created a small README file that describes the plugin and links to
this mailing list thread.
I created a pull request on github[1] which you can simple merge into
your repository. If you do this, the README file is directly integrated
in your branch and is visible on the Github page.

If you have any questions, feel free to ask in this thread or PM me direct.

Kind regards,
Philip

[1]: https://github.com/rahulmaindargi/Osmand-ContactAddressPlugin/pull/1

Marko Mäkelä

unread,
Sep 7, 2012, 2:52:54 PM9/7/12
to osm...@googlegroups.com
keskiviikko, 29. elokuuta 2012 21.23.39 UTC+3 Rahul Maindargi kirjoitti:
 Let me explain ... 
with those changes the intent data (uri) we get is not "geo uri" the "Uri" we get is "content://com.android.contacts/data/5" 

In that case, why does your AndroidManifest.xml advertise that your plugin is accepting geo: intents?

            <intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.APP_MAPS" />
<data android:scheme="geo"></data>
</intent-filter>

I downloaded http://osmand.googlecode.com/files/Osmand-ContactAddressPlugin.apk today. It works with the contacts data. However, the first time (after adb install Osmand-ContactAddressPlugin.apk) when I clicked on a street address in the calendar, my phone asked whether to use OsmAnd or ContactAddressPlugin. Out of curiosity, I chose the latter and got a pop-up saying something like ‘Application ContactAddressPlugin has stopped unexpectedly’. Since then, clicking addresses on the calendar has always invoked OsmAnd.

Can you reproduce this?

 Marko

Marko Mäkelä

unread,
Sep 9, 2012, 3:53:03 PM9/9/12
to osm...@googlegroups.com
Some more weirdness: I played with adb logcat, and found that this plugin is apparently not passing the address data to OsmAnd when I click on a postal address in a contact list item:

I/ActivityManager(  273): START {act=android.intent.action.VIEW dat=content://com.android.contacts/data/postals/3127 cmp=net.osmand.contactaddressplugin/.ContactAddressPluginActivity} from pid 2672
I/ActivityManager(  273): Start proc net.osmand.contactaddressplugin for activity net.osmand.contactaddressplugin/.ContactAddressPluginActivity: pid=2692 uid=10012 gids={}
I/dalvikvm( 2692): Turning on JNI app bug workarounds for target SDK version 10...
I/ActivityManager(  273): START {dat=content://com.android.contacts/data/postals/3127 flg=0x200000 cmp=net.osmand/.plus.activities.search.GeoIntentActivity} from pid 2692
D/dalvikvm( 2704): Late-enabling CheckJNI
I/ActivityManager(  273): Start proc net.osmand for activity net.osmand/.plus.activities.search.GeoIntentActivity: pid=2704 uid=10017 gids={3003, 1015}

Note that the same contact address URI (dat=content://com.android.contacts/data/postals/3127) is being passed to both ContactAddressPlugin and OsmAnd. How can this work?

On a related note, the address search from the calendar seems to work if I only specify the street name and there are no spaces in it. Here is a non-working example (name="Armas Launiksenkatu" in Espoo, Finland):

I/ActivityManager(  273): START {act=android.intent.action.VIEW dat=geo:0,0?q=Armas Launiksenkatu, Espoo cmp=net.osmand/.plus.activities.search.GeoIntentActivity (has extras)} from pid 2778
V/PhoneStatusBar(  348): setLightsOn(true)
I/System.out( 2704): q=Armas,Launiksenkatu,,Espoo

Note how it added a comma within the street name.

q=Kisatie works (and lists several matches all over Finland). But, as soon as I try to add the city, nothing will be found:

I/ActivityManager(  273): START {act=android.intent.action.VIEW dat=geo:0,0?q=Kisatie, Vantaa cmp=net.osmand/.plus.activities.search.GeoIntentActivity (has extras)} from pid 2778
V/PhoneStatusBar(  348): setLightsOn(true)
I/System.out( 2704): q=Kisatie,,Vantaa

 Marko

Rahul Maindargi

unread,
Sep 10, 2012, 11:46:24 AM9/10/12
to osm...@googlegroups.com
I am eally sorry.. cant debug into any of it... my machine died yesterday.. getting HDD replaced and os reinstalled... 

once machine it back... i will look into it.

Marko Mäkelä

unread,
Sep 10, 2012, 4:11:34 PM9/10/12
to osm...@googlegroups.com
OK, no hurry. I hope you did not lose too much data.

This is just a nice-to-have feature to me, and a good learning opportunity of Android IPC and logging.

 Marko
Reply all
Reply to author
Forward
0 new messages