osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.39k stars 988 forks source link

Osmand cannot read its own geo URI / map links when sharing position #1312

Closed frank334 closed 9 years ago

frank334 commented 9 years ago

when sharing a position with someone else via Email or SMS, messages with this content are generated:

geo:lon,lat http://osmand.net/go?lat=....&lon=....&z=19

But when receiving such SMS or Email (with K-9) Mail, these Positions are not transfered to Osmand any more. The geo: URI is not recognized by the SMS/K-9 Viewer. And the osmand.net-URL ist not recognized by Osmand. With another App "Share my Position" it works, because they are using maps.google.com URLs, generating intents that one can choose what App takes the Map link (including Osmand). But with Osmand sharing messages, only the osmand.net-URL opens in the Firefox browser, showing an online map, no choice to view it in Osmand itself.

I checked the "GeoPointParserUtil.java". Possibly the URL-parsing here is buggy or simply not adapted to the osmand.net URLs.

vshcherb commented 9 years ago

Just tested, works fine. May be specific coordiantes

frank334 commented 9 years ago

In the meantime I got updates from the Android Market. Now it's OsmAnd 2.0.4 "2015-05-10" on Android 4.4.2, Tablet and Phone, and tested on a third newer Phone (newer Android). Still the same observation. I don't get the Osmand App from the URL.

Did we talk about the same issue?

The geo: URL is not recognized as a link, but that's a problem of the SMS reader and K9-mail, not an issue with Osmand (a pity, because that would be the most efficient coding)

The link http://osmand.net/go?lat=50&lon=7&z=16

is decoded to an URL-link. I can klick on it an I get the choice to view it in Firefox Browser with the osmand.net opening. That's NOT what I want.

I expect the OsmAnd App to open, i.e. that I can navigate directly to someone who submits his position via location sharing.

When I open an email from another App "Share my position" it works, I can choose between view the map online or open the OsmAnd App. http://maps.google.com/maps?q=50,7

So, something is wrong with the URL-parser. Can you report what exactly works with your configuration?

eighthave commented 9 years ago

FYI, I just submitted a pull request to make K-9 support clickable geo: links https://github.com/k9mail/k-9/pull/684

eighthave commented 9 years ago

I can confirm that clicking on http://osmand.net/go?lat=50&lon=7&z=16 in K-9 does not present Osmand as an option.

frank334 commented 9 years ago

Can we re-open the issue? I didn't find a button for it on github.

Thanks for the request on the K-9 project. This is one part of the problem. K-9 should be able to understand the geo: URI.

The 2 most important channels to share positions are Email and SMS (I don't use Whatsapp). Email ist the most general approach of sharing messages, universal between almost all operating systems and device categories, not so limited as Whatsapp. And SMS is a more robust one, very energy-efficient (the device does not need a permanent internet connection, there are wakeup-signals in GSM instead of constantly polling servers). It's very important for battery life if you make a long bicycle tour with your smartphone. So, I would also like to use location sharing with SMS.

Unfortunately, my Android SMS Inbox does not understand the geo: URI. And I think my smartphone will never get an update to upgrade the functionality.

So, to make location sharing between SMS users immediately available, the OSMAND URL parser could check for the osmand.net Links and start an intent for this. Unfortunately this does not work with osmand.net-Links, only with maps.google.com links. So I the moment I need another app to send the position. It would be more comfortable to use OSMAND directly, i.e. sending locations from routing targets or POI.

I checked the OSMAND source at "GeoPointParserUtil.java". There is code to interpret osmand.net Links, but apparently there is some bug. Is it true,that this parser is really responsible for evaluating the http Links in SMS and K-9 messages? Or maybe another parser?

The decision to send the coordinates in 2 formats simultaneously is ok, one in the geo: and one the the http map URI. At least unless not all applications understand the geo: URI, the most elegant and shortest way of coding coordinates.

vshcherb commented 9 years ago

There is no bug in GeoPointParserUtil, cause it works on many devices. So it wouldn't work on them and there is a special tests in the file which are passing. Sometimes source application don't handle the links, sometimes Android doesn't recognize them in AndroidManifest.xml.

I did a blind fix for now https://github.com/osmandapp/Osmand/commit/0a835b64da8962ed194bf2c5110c1cce294cfa03 (cause I can't reproduce the issue on any device, but that's the most I can do).

frank334 commented 9 years ago

Thanks. Unfortunately I don't have the Android build chain and SDK installed. Is there a binary for testing? At least eighthave had the same problem, so it's not just a problem for my devices.

Maybe that's a difference between the Android versions. Which version do you use? My observation was with three different 4.4.2 phones/tablets.

I think it's not a problem of K-9 http link handling, because the maps.google.com links are handled correctly. The only problem of K-9 is the lack of geo: URI support. Two different methods of location sharing.

there was a change here with the URLs https://github.com/osmandapp/Osmand/commit/56eee3216f4e9a683b126498e8c73dffa6f19eb1#diff-a3c8269ddedbd15469a9520e44980d8f before it was download.osmand.net and now its osmand.net, the later is used for location sharing now

maybe that's the difference and my current Osmand from the market stil uses the old URL scheme?

frank334 commented 9 years ago

Thanks. It works now, after Upgrading to OsmAnd 2.1. The patch you made fixed the Issue. Now if I click on the osmand.net URL I can choose to open OsmAnd. Now it's very useful if you want to tell somebody your location, let's say on a big open air festival or somewhere in the landscape. Once I needed half an hour to meet a friend in a big city park, just because his description was so confusing. Now it's only a click on the smartphone. Wow. I like OsmAnd. The separte App "share my position" is no longer needed anymore. Anyway, OsmAnd offers more comfort. You can choose a pub from the POI and send the location to your friends immediately, before you reach it yourself. And all completly with offline Maps, no Internet needed if you use SMS for the location sharing. Very useful.