Export list of Downloads (no root)


Question

I was using Firefox and for some reason it deleted all downloads from the SD card.



I found an in-built app "Downloads" which has a list of all files downloaded to date, listing both Chrome and Firefox downloads.



Click Image to enlarge



Downloads



How can I export a list of filenames (and their respective URLs, if possible) shown in this "Downloads" app?


Answer

The Downloads app has the name DownloadsProviderUI (com.android.providers.downloads.ui). The entries shown by it are not handled by or stored inside its data directory. Instead, the app is just a front-end for DownloadsProvider (com.android.providers.downloads).



The information you're seeking is stored inside



/data/data/com.android.providers.downloads/databases/downloads.db


Provided that your OEM has not messed up with the manifest of DownloadProvider, you should be able to backup the app using .



Instructions




  1. Setup adb in PC and connect the device, with USB debugging enabled, into PC.

  2. Launch a shell and execute the command



    adb backup com.android.providers.downloads


    Agree for the backup on the device. You should now be having a backup file named backup.ab.


  3. Follow any of the solution here to extract the content from the file. (I prefer Android Backup Extractor.)



    You should now be having a file named downloads.db, possibly under apps/com.android.providers.downloads/db/ (inside the extracted content).


  4. You now have many options to open the database file. You can use GUI solutions like Sqliteman or DB Browser for SQLite. The former one can export the data into an HTML file.



    Anyhow, inside the file, the table downloads has the relevant columns, namely: uri, title and _data.



    If you've sqlite3 installed, you can do:




    sqlite3 downloads.db
    .mode line
    .headers on
    .out info.txt
    select uri,title,_data from downloads
    .quit


    You should now be having a file info.txt. Open it and you would see a structure, such as:




    uri = http://dl-xda.xposed.info/modules/biz.bokhorst.xprivacy_v471_8ba0b6.apk
    title = XPrivacy
    _data = /data/data/com.android.providers.downloads/cache/biz.bokhorst.xprivacy_v471_8ba0b6.apk

    uri = non-dwnldmngr-download-dont-retry2download
    title = ProcessMonitor.zip
    _data = /storage/sdcard0/Download/ProcessMonitor.zip


    There exists other modes for formatting. For e.g., change .mode to csv and .out to file.csv and then keep the rest of the commands intact. Execute all the commands serially and you would end up with a CSV file.



    (You can use PRAGMA table_info('downloads') or .schema downloads to know the name of all the columns inside the table downloads.)



    If required, see this article on ZetCode to know what the aforesaid SQL commands does.



Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes