Parsing HTML file from SDCard

Post the aia or send it privately via PM.
(Upload the APK to Google Drive and post the link.)

WebViewer have only this permission:

@SimpleObject
@UsesPermissions(permissionNames = "android.permission.INTERNET")

He must add file component.

I don't know if the built-in WebView component is able to display files from internal memory. It may be necessary to use the "CustomWebView" extension.

Oh, I didn't check this with AI2, because I assumed it would be the same as for Kodular:

But if the permissions are not declared in the Manifest, there shoud be no permissions in the app settings. So the greyed out part should not appear.

Well, I don't know how or why, but it has started working by itself. Although I was doing a clean install every time for the new app (deleting old app completely, and then installing new), but still it has started working without any proper logic I could identify. Here is my code in any case:

The app now prompts for the ACCESS PERMISSION TO STORAGE at initialization, and then displays the page comfortably.

What I am concerned now, is to find a proper way to access the SDcard contents. This path which is working for me (/storage/0000-0000/LMS/) does not seem to be the standard method of calling any sd card (I assume). I tried the code piece below (file:///mnt/sdcard/LMS/index.html) but somehow it opens the LMS folder present at the root of the phone memory (not the sdcard one - I checked very carefully by changing names).

What is the standard way/path of calling any content on the sdcard?

I change the URL to /storage/emulated/0/LMS/index.html and permission error is again started to appear! Also, the webviewer error is FILE NOT FOUND.

Getting weirder :slight_smile:

You probably told yourself that this would not work!

If you use Taifun's File extension, it has a block to show you the available storage directories, which you can then use in your file path (the external sdcards can have a different address on each device you use)

I used Taifun's plugin. It does list /storage/emulated/0/ as a valid directory; however the app does not engage sdcard on this path (I assume it is symlink to internal memory it seems).

is the "internal" virtual sdcard on the device. It is not the one you want. Did the block not show any other available storage directories?

Well yes. The other directory name was same which I am trying to avoid, i.e. /storage/0000-0000/abcdef

However, I think this trick (image below) is still better than absolute hard-coding the above path, as I assume that the function AvailableStorageDirectories will always list external sdcard path first:

Connect the device to Companion, make a right mouse click on this block "Do it" and post the result:

... and also on this block:

For some weird reason, my 'DO IT' item on right-click are disabled... I tried refreshing the app too, doesn't work.

The APK is working though.

Obviously, it's not connects with Companion. As I said, connect with Companion.

grafik

Ohh my bad... I came back to companion after many years, literally! Making stupid mistakes... :slight_smile:

Here it is:

Here I am just hoping (and praying) that the external sdcard address always remains in the first index, else the logic crashes. Don't want to go more complex of parsing the whole list and checking for an error for switching to next...

This path exists on all Android versions:

/storage/emulated/0/

So I should always pick the path !equal to this? Would that be the correct logic?

We could have abbreviated this significantly if you post the AIA as I suggested.