Can I add links in waypoints pointing to the local file system?

Fred Eric shared this problem 4 months ago
Solved

I am trying to add a link in a wpt element pointing to a locally stored html file:

<wpt lat="0" lon="0">

<name>Test</name>

<desc>Test waypoint with a link</desc>

<link href=file:///sdcard/files/test.html><name>Click Me</name><type>text/html</type></link>

</wpt>

When clicking the link in Locus Pro, I get an "unexpected problem". Using the link in the default browser works fine.

Am I doing something wrong?

Comments (6)

photo
1

Good day Fred,

this should work fine. May you upload me here some sample file please? Thanks

photo
1

I am not an expert.

But adding " " seems to work fine.

(I compared with working examples)


<link

href="file:///sdcard/files/test.html"

>

<name>Click Me</name>

<type>text/html</type>

</link>

photo
1

Here is an example. I tried with/without a type element but it makes no difference.

I used the double quotes around the href attribute (just forgot to copy them when reporting the problem).

Files: Test.gpx
photo
1

Thanks Fred for a file.

Uff complicated task. This is nice example of updates in Android 7+. I had to make a hack to bypass Android implementation how click on such links is handled. It should work in next Locus Map version. Let me know if there still be any problem, thanks!

photo
1

Hello,

The new version gets me one step further. When tapping the link, I get an orange message telling me than an application is missing to perform the action. However, I believe it is not a Locus problem. I am using a vanilla Sony Xperia with Nougat (i.e. not rooted or modified in any way). The version of Android shipped by sony does not have a lightweight default browser embedded in the OS. It simply comes with Chrome that is the only default browser. It looks like the latest version of Chrome does not register the "file://" scheme. It can open URL's with such a scheme when typed in the URL bar, it can save them as favourites but it does not allow creating shortcuts for them.

I suppose you will advise me to install Firefox...?

[Edit]

I just tried adding a second link, this time by editing the waypoint in Locus instead of importing a GPX. It prompts me to select an application and, after selecting Chrome, it starts the browser and displays an error message (site is not accessible). The displayed URL is:

content://com.asamm.locus.pro.provider/app_external_files/[path]

[Edit more]

The difference in behaviour is because I used an HTML page in the first case (application missing) and a directory in the second case (site not accessible)

[Edit continues]

... so I tried adding the name of the file in the content:// URL to see what happens and I get a "file not found" error (I tried with /path, /sdcard/path and /localhost/sdcard/path).

photo
1

Good day Fred,

a while after I published this latest version, I was solving one more problem related to this and found an new issue. So both problems you mentioned should now be solved, so if possible, please wait on next version, where I believe it will work a lot better, thank you and sorry for additional work!