CustomWebView : An extended form of Web Viewer

Why can’t i click the choose file and location? it’s a webviewer

Explain.

Image Upload and Title this is the link
i use on the webviewer but the choose file wasnt able to be click do you have any idea to fix it? im new and still learning on mit app

Are you using CustomWebView or Webviewer?

webviewer

You can't access the file system in WebViewer. You do that with CustomWebViewer (where you are now) and it's done like this


Take note of FileUploadNeeded and AfterActivity. In your case I believe ActivityStarter's DataType would be 'images/' instead of 'text/'

1 Like

Well, you can, but you have to use a different extension.....

Ok, yeah I guess my phrasing was technically incorrect. But anyway, as for getting a blob... I've been trying for 2 hours to find any way to get the data. I'd be fine with sending it to a label or something but I can't find any way to get the actual data. I can see the data is there, but I cant access it. I have tried every function on CustomWebView and KIO4_base64.

Unfortunately it is not possible download content from blob url directly.
But if has base64 data then please post that here. We can do something in that case only.

what extension can i use?? so hard to find it

In the above screenshots (post 377) I can see the the page incrementing the "Got boot.py, X bytes" and each time it does I get a new OnDownloadNeeded; so I know the data is going somewhere that CustomWebView is picking up, but I don't know how to see it. The web page source can be seen in the same post I made but I'm way better at working with microcontrollers than I am Java or HTML. Everything works in all mobile browsers but they all zoom in as far as possible every time a new command is sent and you have to zoom back out to read the response or send another. This is incredibly annoying and painful to use. That's the whole reason I'm trying to use CustomWebView. Everything else works but I want to be able to get the file or at least read it in a label and it's proving impossible for me.

https://github.com/vknow360/CustomWebView/tree/master/aix and the built-in ActivityStarter

can you show the example of the code? im kinda new to mit

@Brad_Bock

I don't know what that means though or how to do it. I know c++ and python very well but this java and html stuff I just don't know very well. I get app inventor and the concept behind how this all works but I have no clue as to how I would get this data upstream. I don't even know what upstream means. I know I can process the data once I get it, but I don't know how to even get it. I just need the data inside that file when I click "Get File" on the web page. I don't care is it comes formatted as base64 and I don't need it to save or anything. I know it's going somewhere and upstream keeps getting mentioned, but how do I get upstream data?

downstream = in your AppInventor App
upstream = in your python coding that is generating the blob url

Are you able to "get" the blob from the blob url and convert it to a base64 string in your python coding?

If so, can you download that base64 string to your Appinventor app, where you can use a base64 extension to convert it back to a binary file (and give it a filename) ?

There's actually no python, or anything upstream at all to change for what this is doing really. There is but there isn't. The device is hosting an HTML webpage and that's what I'm interacting with. While I could make changes to the upstream I'm very hesitant to do that, as this is the way it's all worked for many years, for millions of devices. And it does this VERY deep into the core of microPython. You don't code any of this, it's built-in. When you flash micropython to your device, it comes with that webpage working exactly how it does. And it works exactly that way for millions of devices. I only posted the source code to show how the webpage works but it comes hosting that. You don't write it. CustomWebView and WebView are the only things that have any sort of issue whatsoever. Normal android browsers get the file just fine, they just also do this really annoying zoom into full every time a command is sent thing. It only happens on android though, not on PCs or IOS. This project is not just something for me but for everybody, so making changes to something so deeply embedded into how microPython works really doesn't seem like a good idea. I'd rather just tell everybody to use their standard android browser and deal with the frustrations that come along with that. And honestly I think that's where I'm at because I can't get any sort of string or anything. Either the problem is in CustomWebView or I just can't figure out how to get a blob with it, but I very seriously doubt the issue is on the upstream side. There literally are millions of devices running the EXACT same code. As I said, all other android browsers can get the file just fine, they just also zoom on every command. CustomWebView prevents the zoom and does everything else, but can't get files like every other Android browser does. I cannot get anything. No strings, no files, no anything. Just notifications that data is being received, but no way to see that data. I keep being told android can't get blobs and okay cool, that's probably right, but all other android browsers get a file like it's requested, when it's requested. This isn't even an issue outside of this extension. I give up.

It is. Android's Webview can't download file from blob urls directly and CustomWebView is the same webview.
You can read about it on Stack overflow.

That's the difference between a Browser and Webview. All the features you see in browsers is not available in Webview.
Mostly browsers extend Webview class and implement their own methods to add more and more features.

However, downloading blob files might be possible with some workaround but not at this moment. You may be able to see this feature in near future, maybe months or a year.

Ok that actually makes sense. But what still doesn't make sense is why I can send a file but not get one. I'm limited in my understanding of HTML and JavaScript but it should be the same but opposite directions right? So WebView can send a blob but not receive one then?

Yes, this is somewhat right.
As far as I have read about blob it is like array of bytes or something like that which is easier to produce inside webpage but difficult to receive in webview.