This is a nice format of shortlink since it uses a public, offline algorithm
to generate them. So Osmand can get what it needs from the shortlink
without going online.
https://wiki.openstreetmap.org/wiki/Shortlink
When a user clicks on a URL that OsmAnd claims, they will first go to the
GeoIntentActivity, which will show them the processing, and any errors,
then it'll take them to the map. Since the map will stay in the same task
as the original Activity where the user clicked it, the user is very likely
to be clicking on the back button. Calling finish() here gives them one
less thing to click back on, since GeoIntentActivity will be removed.
closes#1037https://github.com/osmandapp/Osmand/pull/1037
This method is used to parse the custom OpenStreetMap shortlink algorithm
that encodes lat, lon, and zoom. The previous version,
MapUtils.decodeShortLocString(), only parsed lat, lon from the shortlink.
This puts them all into a single <intent-filter> to improve readability and
reduce the number of IntentFilters used. This also adds some new domains:
* maps.yandex.com
* map.baidu.cn
* map.baidu.com
* wb.amap.com
* www.amap.com
It seems this code is quite out of date, because none of the URL formats
listed in the tests seem to work. This commit updates the URL formats in
the tests, then makes all of them parse properly. It also changes the
parsing technique, leveraging java.net.URL's built-in parsing abilities to
assist. Also, I plan on adding a lot more URL formats, so the current code
structure made it very difficult to add to. So each service will be split
out into its own section, starting here.
For the record, I do not think it is a good idea to share location using
HTTP, it should always be HTTPS. There are too many privacy concerns.
@vshcherb says he plans on adding HTTPS to osmand.net, so that will be good
once it happens.
osm.org is the official short URL for OpenStreetMap, with proper HTTPS
coming soon. openstreetmap.org is the temporary short URL since it already
supports HTTPS.
In order to maintain privacy when sharing location, this changes the shared
location link to use HTTPS, thereby hiding the location info from anyone
who might be snooping on the WiFi, ISP, internet, etc.
Unfortunately, http://osm.org does not yet work with HTTPS, but the
standard OSM URLs are short enough to fit into a text message. They are
planning on supporting https://osm.org in the future:
https://github.com/openstreetmap/operations/issues/2
fixes this stacktrace:
StrictMode E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E java.lang.Throwable: Explicit termination method 'end' not called
E at dalvik.system.CloseGuard.open(CloseGuard.java:184)
E at java.util.zip.Inflater.<init>(Inflater.java:82)
E at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:96)
E at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
E at net.osmand.plus.download.DownloadOsmandIndexesHelper.downloadIndexesListFromInternet(DownloadOsmandIndexesHelper.java:112)
E at net.osmand.plus.download.DownloadOsmandIndexesHelper.getIndexesList(DownloadOsmandIndexesHelper.java:38)
E at net.osmand.plus.download.DownloadIndexesThread$1.doInBackground(DownloadIndexesThread.java:377)
E at net.osmand.plus.download.DownloadIndexesThread$1.doInBackground(DownloadIndexesThread.java:373)
E at android.os.AsyncTask$2.call(AsyncTask.java:288)
E at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E at java.lang.Thread.run(Thread.java:841)
Some networks require a proxy to get internet beyond the firewall, and
proxies are also useful for channeling all traffic through circumvention
and privacy proxies like Tor, I2P, Psiphon, etc. In places where the
connection to download tiles might be blocked, using a proxy can give the
user access.
To increase user privacy, especially with traffic that includes sensitive
information like location and tracking markers, HTTPS should be used
whenever possible. It seems that HTTPS is broken for a lot of sites on
versions older than android-10/Gingerbread, so HTTPS is not used on those
old platforms.