App Inventor and the Web component

File Download with App Inventor

This simple example shows how to download a file from the internet to your device.
You also might be interested in the Webprefetch File by File solution.

App Inventor Blocks

added the new permissions events and method for the SDK 26 release
In the example projecxt downloading a file and storing it on the internal sdcard of the device requires the permission android.permission.WRITE_EXTERNAL_STORAGE. In case the user does not grant that permission, the app will close.


File Download from a Restricted Area

This example shows how to download a file from a password protected area to your device. I prepared this webpage using basic HTTP authentication, which means, you can access this area only after login with username and password. Try it with username=appinventor and password=appinventor. To be able to do the authentication with App Inventor, we have to add an Authentication header.

The Authorization header is constructed as follows (source: Wikipedia):

To make it as simple as possible, I just Base64 encoded the username:password string appinventor:appinventor using this page which results in YXBwaW52ZW50b3I6YXBwaW52ZW50b3I= and put that hardcoded into the header. That's all.

App Inventor Blocks

For questions about App Inventor,
please ask in the App Inventor community.Thank you.



Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:

Thank you! Taifun

File Download example
Download aia file for App Inventor

File Download from Restricted Area example
Download aia file for App Inventor

Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.

Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact