Open gpx file in webviewer with run javascript

moving to new topic....

It looks like you are using a file picker extension... which one? Any link? That extension probably is not able to pick a file from the assets...

Also in your other thread you mentioned

But what I want to send a new file to the webviewer that doesn't exist in assets before compiling

Which means reading the file from the assets will not help very much anyway...

Taifun

I am using :

Could it be a problem related to permissions?
I am using this block at the start of the app

I am using:

Which means reading the file from the assets will not help very much anyway...

That's right, what I'm trying to do is to load a .gpx file that is in a directory on the mobile phone.

  1. In which directory?
  2. Where does the GPX file come from?
  3. Was it created by the app itself?
  4. Read this: How to access non-media & media files on Android 11+
  1. In which directory?
    In any directory or by creating a specific one. In companion it works from any directory.
  1. Where does the GPX file come from?
  1. Was it created by the app itself?
    any file imported in gpx format, not created by the app
  1. Read this:
    Apparently I can read it, since it works in companion.

Which Android version are you testing on?

"In companion it works from any directory."
No, not on Android 11+ (at least not with non-media files).

My Android version is: 10 QKQ1.190910.002

Yes, on Android 10 you have full access to the external storage, because AI2 decided to declare requestLegacyExternalStorage = true in the Manifest. On all Android version > 10 you have to live with "Scoped Storage".

So, what would be the solution??

If the GPX (non-media) file is not created by the app you must use SAF to access (read) it.

(Otherwise you have to declare, request & grant MANAGE_EXTERNAL_STORAGE permission. Search the forum for more details.)

:question:

Where does the GPX file come from?
Usually imported from wikilock .... or any other database.
Other times it is prepared in GIS applications.
There are a lot of sources where to find and download gpx files.

It doesn't matter where GPX files generally come from, but where do those come from that you want to read with your app. Are these generated by / during use of your app?

Previous discussions of gpx files on this community. might be of interest if you cannot find a solution using javascript.

I read the gpx format and use a java script to convert them to geojson and send them to webviever for viewing.
The original .gpx can be placed in any accessible directory.
I suppose that you know them but I attach a .gpx file
Etapa1.txt (17.2 KB)
Change the extension to gpx, I can't upload files with the .gpx extension.

And again:

but where do those come from that you want to read with your app. Are these generated by / during use of your app?

NO. I do not generate them with the app, they are files imported from different sources.
I can put them in any accessible directory.

Ok, then you need SAF.