Categories

Follow Us @web_learners

Monday, July 5, 2021

How to Enable File Upload and Download in Android Webview App | Webview App Development Series Part 19

July 05, 2021 1 Comments

 Hi Everyone, Welcome to our mobile app developer training. As we are Converting our website to apk, in the previous tutorial we have learned How to Enable Video, Image and File Upload in Android Webview App.

And we also have learned separately How to Upload files in Android Webview App and How to Download the files in the android webview app

Now we will combine uploading files and downloading files code together and will implement them in one Webview app project. 

First of all, you need to add 3 permission for "access camera, write in external storage and Internet" in your AndroidManifest.xml file. 


Code:

Then, we need to take some variables, such as:

Code:


After that, we will move to the "onCreate" method, and in the "WebChromeClient" function we will write the "onShowFileChooser" function.


Code:


Now we will write code for Downloading any files in Android Webview App. First, we will write a function for file saving permission to your device.


Code:


And then we will write code for allowing download file in the Webview app.

Code:


We have finished the coding within the onCreate method, Now we will write several functions outside of the onCreate method.


Code:


That's it, we have finished coding for Uploading and downloading files in the Android webview app. Let's run the project and test.




As you can see in the above picture, Downloading any file and uploading any type of file in Webview App is working perfectly. See you in the next tutorial.

Saturday, July 3, 2021

How to upload multiple files in webview android app | Webview App Development Series Part 18

July 03, 2021 1 Comments

 Hi Mobile App Developers, In the previous video we have learned that How to Enable File upload in Android Webview app. And I told in the last video that we will learn today how to upload multiple types of files together in the Android webview app.

As we saw in the last tutorial, we are able to upload any type of file such as Audio, Video, Txt, XL, Zip, PPT, etc. But we saw that we can only select one file and upload one file at a time,  So today we will learn How to select multiple files and upload multiple files together in the Android Webview app.

We will continue with the last tutorial code, If you have not followed that tutorial yet, first follow that tutorial, then continue this tutorial. Let's Start.

First, we will take a boolean variable, we will name it multiple_files, and the value we will store is "Yes".



Code:


Now we will move to the "onShowFileChooser" function, in that function you will find we have written code for file selection, now we will write code there for multiple file selection.


Code:


These codes will help you to select multiple files at a time in the Android webview app. Now let's see what will be the full code within the "onShowFileChooser" function.

Code:


Just need to add these line of code in "onShowFileChooser" function , and all the other code of Upload file in Webview (my last tutorial) are same such as "onActivityResult", "onConfigurationChanged""file_permission" , "create_image()", "create_video()".  Now let's run the project and check whether Multiple file selections and multiple file uploading in the Android webview app are working or not.


As you can see in the above picture, multiple file uploading working perfectly. This way you can convert your website easily. It works like website to apk converter

In the next, I will show you How to Enable Upload and Download in Android Webview App.