androidapiadbandroid-download-manager

How to detect that android finished downloading in adb?


I have a script that does some things on an android phone.. one of the things is to download some files - which I need to wait for them to download before going to the next stage..

I tried to wait a static amount of time... didn't work because download time varies I tried to search if the downloaded file exists with a loop, but the filename is not constant...

I'm looking for the way to detect if a download process from a certain process (or activity) is ongoing - via adb.. is that possible?

Thanks


Solution

  • I was able to solve this problem by checking the response from

    adb shell dumpsys activity services | findstr download
    

    when the response was 'nothing' that meant that the download service isn't running, else it returned the service record