workPro Documentation
Downloads & Setup
DOWNLOAD_SETUP.md

Download Feature - Quick Setup Summary

✅ What's Been Configured

Your WorkPro app now has complete download support with proper permission handling:

1. Android Manifest Permissions

  • WRITE_EXTERNAL_STORAGE (Android 9 and below)
  • READ_EXTERNAL_STORAGE (Android 10-12)
  • READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, READ_MEDIA_AUDIO (Android 13+)
  • DOWNLOAD_WITHOUT_NOTIFICATION

2. Runtime Permission Handling

  • Automatically requests permissions when user clicks download
  • Works for Android 9 through Android 14
  • Handles Android 10+ app-specific storage automatically

3. Download Manager Integration

  • Uses Android's DownloadManager service
  • Shows progress notification
  • Auto-saves files with original filename
  • Shows completion notification

🔧 How It Works

When User Clicks Download Button:

HTML/PHP Download Link
         ↓
    WebView Detects
         ↓
  Permission Check
         ↓
Permission Granted?
    ├─ YES → Download Starts
    └─ NO → Request Permission
            ↓
         User Approves?
            ├─ YES → Download Starts
            └─ NO → Error Message

📁 Download Locations

Android 13-14 (API 33-34):

/Android/data/com.workpro.app/files/Download/

(Accessible via: Settings > Apps > WorkPro > Files)

Android 12 (API 31-32):

/Android/data/com.workpro.app/files/Download/

Android 11 (API 30):

/Android/data/com.workpro.app/files/Download/

Android 10 (API 29):

/Android/data/com.workpro.app/files/Download/

Android 9 (API 28):

/storage/emulated/0/Download/

(Accessible via: Files app > Downloads)

📋 Installation Permissions Dialog

When users install the app, they'll see:

For Android 13+:

  • "Photos and videos" - to access media

For Android 10-12:

  • "Photos, media, and files" - to access storage

For Android 9 and below:

  • "Storage" - for download storage access

Users can grant or skip. If skipped, they'll be prompted when they click download.

🎯 Testing Checklist

  • [ ] Build and install APK on device
  • [ ] Create download link in your PHP/HTML:
    <a href="https://example.com/file.pdf" download="filename.pdf">
      Download File
    </a>
  • [ ] Click link in app WebView
  • [ ] Grant permission when prompted
  • [ ] Verify notification shows download progress
  • [ ] Check file appears in Downloads folder
  • [ ] Open file from notification to verify download

🔍 Debugging

Check Logs:

adb logcat | grep WorkPro
"Download requested: [URL]"
"Starting download from URL: [URL]"
"Download enqueued with ID: [ID]"
"Download started: [filename]"

Common Issues:

  1. "Download failed: Invalid download URL"

    • Check URL is accessible
    • Verify HTTP/HTTPS is correct
    • Check server allows file downloads
  2. "Permission denied"

    • User denied permission
    • Grant in Settings > Apps > WorkPro > Permissions
  3. Download doesn't appear

    • Check notification (swipe down from top)
    • Check Downloads folder location for your Android version
    • Check app-specific storage (Settings > Apps > WorkPro > Files)
  4. File not found after download

    • Android 10+: Check app's private files directory
    • Android 9-: Check system Downloads folder

📱 User Instructions

For End Users:

  1. Open WorkPro app
  2. Navigate to page with download link
  3. Click the download button
  4. If prompted, tap "Allow" for storage permission
  5. Download begins with notification
  6. Notification shows when download completes
  7. File saved automatically to Downloads folder

To Access Downloaded Files:

  • Android 13+: Settings > Apps > WorkPro > Files > Download
  • Android 10-12: Settings > Apps > WorkPro > Files > Download
  • Android 9: Open Files app > Downloads folder

🚀 Build and Deploy

Build APK:

./gradlew clean assembleDebug
# or
./gradlew clean assembleRelease

Install on Device:

adb install -r app/build/outputs/apk/debug/workpro_*.apk

Test Release:

./gradlew clean assembleRelease

📊 File Permissions Summary

Android Version Min API Download Path Permission Needed Scoped Storage
14 34 App-specific NO ✓ Enforced
13 33 App-specific NO ✓ Enforced
12 31-32 App-specific NO ✓ Enforced
11 30 App-specific NO ✓ Enforced
10 29 App-specific NO ✓ Enforced
9 28 Public Downloads YES ✗ Not enforced

✨ Features Implemented

  • ✅ WebView download detection
  • ✅ Automatic permission checking
  • ✅ Runtime permission requests
  • ✅ Multiple Android version support (28-34)
  • ✅ Download manager integration
  • ✅ System notifications
  • ✅ Progress tracking
  • ✅ Filename extraction
  • ✅ Error handling
  • ✅ User-friendly messages

📞 Support

For download issues, check:

  1. Internet connection status
  2. File URL accessibility
  3. Permission status (Settings > Apps > WorkPro > Permissions)
  4. Notification panel (swipe down from top)
  5. App logs (adb logcat | grep WorkPro)
workPro Documentation | v1.3
Login to Dashboard