-
Notifications
You must be signed in to change notification settings - Fork 0
Switch to embedded NanoHTTPD with Storage Access Framework to access content #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is quite interesting from ChatGPT. This implies that I could replace the Csound for Android app with a new and perhaps simpler app that serves cloud-5. |
Good news:
Bad news:
|
It is clear that Android has chosen to close as many security loopholes in WebKit as possible even at the compromise of functionality. I cannot and will not fight this. I will investigate using a local Web server inside the app. This would be the Android equivalent of NW.js. |
Using a local Web server is not a panacea. The WebKit file access error will go away, but security risks remain. The best thing might be to configure the Storage Access Framework to grant permissions for the user's selected Web directory. |
It takes some work to make this work, see this response.. |
At this moment, I don't want to do this. I suppose that Web server apps for Android work this way, I will take another look at them. |
Here is my plan:
|
The objective is to replace the current WebView functionality for HTML pieces, and perhaps for browsing external sites, with an embedded NanoHTTPD local Web server.
|
NanoHTTPD has not had a commit in 5 years.... |
I tried a better prompt. |
For reasons I don't fathom, the Csound for Android app has starting playing the HTML examples just fine in the emulator. Perhaps the emulator is out of date. I will look at that. Yes, I was emulating Android 11. I created a new emulator for Android 15, Pixel Fold. It takes a long time to install because of cloud-5. Now it's behaving like my phone, and I can continue to debug it and try out the local Web server idea. |
I will need to resolve content and provide MIME types for file suffixes. This can be used. |
I have to do this before anything else: https://chatgpt.com/c/671ab00f-1a3c-8009-9c5b-1fd16edc8caf. |
This is all taking a very long time. There are many changes enforced by the SAF and new policies. Without ChaptGPT this would be taking 2 to 3 times as long, however. |
OK, Scrims shows up and controls work, but there's apparently no access to the Csound object, must be thanks to different JavaScript contexts. |
I researched SimpleHTTPServer. I don't find source code. I don't find alternatives. I installed SimpleHTTPServer on my phone. It starts to render scrims.html but Csound doesn't start, probably because the operating system is identified as Android. In other words, behaves just like the The implication is that I can change In that case, there would be no difference between the Csound for Android app and SimpleHTTPServer as far as cloud-5 is concerned. |
More specific help including how to debug: https://chatgpt.com/c/67216fa8-6850-8009-9aef-7ffd00c59d6c. |
Subdirectories are an issue. I will have to recursively descend the tree, perhaps. For now, I'll test by moving all files to the root. |
I got The subdirectory permissions appear to be a issue. |
This now actually seems to be working. The code has a straightforward recursive search through the Storage Access Framework HTML directory and serves input streams, not files. And the details are baroque. But it works. This is the first substantial piece of code that I have written using ChatGPT. I think it helped quite a bit. I will review and clean up the code soon. |
Doesn't work on my Galaxy S24 Ultra, which is Android 14, API 34, not 15 and 35. |
|
I had two names for shared preferences, have now switched to no name (defaults to activity class name). |
That didn't work either, fixed by using |
I set up the emulator for a tablet running Android 14 API level 34. And |
But that only works in the emulator. On the phone, it's not working. The |
The problem was I selected the wrong |
Prevents HTML pieces from working in Android 14. See:
https://chatgpt.com/c/67170112-4a64-8009-abaa-44fd858d4601
and:
https://developer.android.com/about/versions/14/behavior-changes-14
This might help work things out:
https://developer.android.com/guide/app-compatibility/test-debug
There may be a need for granular media types in accessing files.
The text was updated successfully, but these errors were encountered: