Web Addon Extension

Hello everyone

I share this extension to download files and save to internal memory with a single method.

can read information as it works internally in the following link App Inventor Tutorials and Examples: File Download | Pura Vida Apps

the code of the methods is the following

@SimpleFunction(description = "")
public void DownloadDrive(Web web, String path , YailList nameList, YailList codeDrive, int item  ){

	String url = "https://drive.google.com/uc?export=download&id=";

	String nameString = YailList.YailListElementToString(nameList.get(item));
	String codeString = YailList.YailListElementToString(codeDrive.get(item));

	web.SaveResponse(true);
	web.ResponseFileName( path + nameString ); 
	web.Url(url + codeString);
	web.Get();

}

@SimpleFunction(description = "")
public void DownloadImageUrl(Web web, String path , YailList nameList, YailList urllist, int item  ){

String url = "";

	String nameString = YailList.YailListElementToString(nameList.get(item));
	String codeString = YailList.YailListElementToString(urllist.get(item));

	web.SaveResponse(true);
	web.ResponseFileName( path + nameString ); 
	web.Url(url + codeString);
	web.Get();


}


 @SimpleFunction(description = "")
 public void DownloadImageDropbox(Web web, String path , YailList nameList, YailList codes, int item  ){


	String nameString = YailList.YailListElementToString(nameList.get(item));
	String codeString = YailList.YailListElementToString(codes.get(item));
	
	String url = "https://www.dropbox.com/s/"+  codeString + "/" + nameString +"?dl=1";

	web.SaveResponse(true);
	web.ResponseFileName(path + nameString ); 
	web.Url(url);
	web.Get();


}

You can have more information and download links in the following link

Saludos

Andres Cotes

7 Likes