Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Download Manager

I want to implement a solution where I want to catch the android.intent.action.DOWNLOAD_COMPLETED intents from the Android Market App i.e after the download of the app. The android Market app uses the default Download Manager and the download manager on the completion of the download sends such an intent, however I have not been able to capture it,I followed this tutorial and please refer to this to have more details on how market app uses Download Manager and for more information on Download Manager refer to this. Please do suggest me a way to catch those intents.

EDIT This is what I am using for my Broadcast Reciever

<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER">
</uses-permission>


<application android:icon="@drawable/icon" android:label="@string/app_name">
    <receiver 
        android:name=".DownloadReceiver"
        android:permission="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS"
        android:exported="true">

         <intent-filter>
            <action
                android:name="android.intent.action.DOWNLOAD_COMPLETED">
            </action>
         </intent-filter>
     </receiver>
  </application>
like image 533
hassanadnan Avatar asked Jan 30 '26 23:01

hassanadnan


1 Answers

You've got everything right except the name of the action in the intent filter. Note the DOWNLOAD_COMPLETE instead of DOWNLOAD_COMPLETED

    <receiver 
        android:name=".DownloadReceiver"
        android:exported="true"
        android:icon="@drawable/download_icon" >
        <intent-filter>
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
         </intent-filter>
     </receiver>        

This worked for me. You do not need to register the receiver in code, this will listen even when your app isn't running.

like image 84
Josh Avatar answered Feb 01 '26 14:02

Josh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!