Download google drive link in Sketchware he

Sketchware Me Google Drive Link Se File Download Kaise Kare (Complete Guide)



Is tutorial me aap seekhenge ki Sketchware Pro Android app me Google Drive link se file download kaise karte hain. Bahut se developers apni app ke liye PDF, ZIP, APK, images ya documents Google Drive par upload karte hain aur chahte hain ki user bina browser open kiye direct app ke andar hi file download kar sake.

Sketchware me Google Drive download ke liye koi direct block available nahi hota, isliye hum yahan Android DownloadManager ka use karenge. Ye method bilkul safe hai aur beginners ke liye bhi easy hai.


Why Download Google Drive Files in Sketchware?

Google Drive ek popular cloud storage platform hai jahan developers apne resources secure rakh sakte hain. Sketchware app me Google Drive file download feature add karne ke kai fayde hain:

  • User ko external browser open nahi karna padta
  • Files direct Downloads folder me save hoti hain
  • PDF, ZIP, APK, image aur document sab support hote hain
  • Android ka official DownloadManager use hota hai (safe & trusted)

Requirements

  • Sketchware Pro installed hona chahiye
  • Basic Sketchware blocks ki knowledge
  • Google Drive file public access me ho
  • Internet connection required

Step-by-Step Implementation

Neeche diye gaye steps ko carefully follow karke aap apni Sketchware app me Google Drive file download feature add kar sakte hain.

Step 1: New Project Create Kare

Sketchware Pro open karke ek naya project create karein.

Step 2: Google Drive File Public Kare

Google Drive me apni file par right click karein aur Get link option se file ko Anyone with link par set karein.

Step 3: main.xml Design

main.xml me following components add karein:

  • 2 EditText: edittext_drivelink, edittext_filename
  • 2 TextView: text_id, text_link
  • 3 Button: button_id, button_download, button_clear

Step 4: Internet Permission Add Kare

Permission Manager me jaakar INTERNET permission add karein.


Extract Google Drive File ID

Ab ek more block banayein jiska naam ho: extractId [String url] aur usme neeche diya gaya code paste karein.


if (_url == null) return "";

String regex =
"(?<=/d/|id=|folders/)[a-zA-Z0-9_-]{10,}";

Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(_url);

return matcher.find() ? matcher.group() : "";

Download File Using DownloadManager

Ab ek aur more block create karein: startDownload [String url][String filename] aur neeche diya gaya code use karein.


DownloadManager.Request request =
new DownloadManager.Request(Uri.parse(_url));

request.setDestinationInExternalPublicDir(
Environment.DIRECTORY_DOWNLOADS,
_filename
);

request.setNotificationVisibility(
DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);

request.allowScanningByMediaScanner();
request.setTitle("Downloading file");
request.setDescription(_filename);

DownloadManager dm =
(DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);

dm.enqueue(request);

Variables Create Kare

  • String url
  • String id
  • String downloadUrl
  • String filename

Button Events Setup

Extract ID Button

button_id ke onClick event me:

  • URL se ID extract karein
  • Download URL create karein

Download URL format:
https://drive.google.com/uc?export=download&id=FILE_ID

Download Button

button_download ke onClick event me startDownload(downloadUrl, filename) call karein.

Clear Button

button_clear ke onClick event me sabhi EditText aur TextView reset karein.


Common Errors and Solutions

  • Download failed: File public nahi hai
  • Invalid ID: Google Drive link galat hai
  • No notification: Permission check karein

Frequently Asked Questions

Is method se APK download ho sakta hai?

Haan, APK, PDF, ZIP, image sab download ho sakte hain.

Kya ye method safe hai?

Bilkul safe hai kyunki ye Android ka official DownloadManager use karta hai.

Kya ye method sab Android version par kaam karega?

Haan, ye method zyada tar Android versions par kaam karta hai.


Conclusion

Is tutorial me aapne seekha ki kaise Sketchware app me Google Drive link se file download ki ja sakti hai. Ye method simple, secure aur beginners ke liye perfect hai. Aap is feature ko apni educational, utility ya file-sharing apps me use kar sakte hain.

Agar aapko Sketchware se related aur tutorials chahiye, to Sketchware Hub website ko follow karte rahein.

Post a Comment

0 Comments