App not receiving android.intent.action.DOWNLOAD_COMPLETE intent
Asked Answered
V

3

7

I am writing a simple app that would get notified when any download via the Download manager is completed on the android device. I have created a Broadcast Receiver for the same and set the intent filter as below in my Manifest file. However my broadcast receiver does not get invoked when download is completed . Is there some other permissions that I need to set as well so that my app receives the DOWNLOAD_COMPLETE intent sent by the Download Manager ? Please note : my app needs to listen to any download that is completed via the Download Manager

<receiver
    android:name="com.example.filedownload.Downloadlistener" >
       <intent-filter>
        <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
        <action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
       </intent-filter>
</receiver>

Following are the permissions used :

<uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Velasco answered 16/4, 2013 at 16:12 Comment(2)
having the same issue. Receiver seems to be correctly declared in the manifest but it is never called. Did you find your solution?Machinegun
just posted a solution. See belowMachinegun
M
11

I did finally manage to fix this issue by adding the following permission to my manifest:

<uses-permission android:name="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS" />
Machinegun answered 15/9, 2013 at 14:8 Comment(3)
Does this work even if your application is not the one downloading and its some other application that is downloading ?Velasco
I don't think so but I haven't tested.Machinegun
Is it depricated ? I cannot find this permission in official docs. Only INTERNET is needed. developer.android.com/reference/android/app/…Onstad
A
1

Is your BroadcastReceiver really called com.example.filedownload.Downloadlistener? You probably need to change it to match the actual name.

Aframe answered 16/4, 2013 at 16:15 Comment(1)
Yes, the package name is com.example.filedownload and the Receiver is Downloadlistener . I think the receiver is fine since If I declare the VOLUME_STATE_CHANGED intent and increase or decrease the volume button , my broadcast receiver is invoked. However for these 2 download manager intents it never enters the broad cast receiverVelasco
F
1

Late to the party, but got a chance to look into the source code for the download manager, and it seems that the Download Complete broadcast is targeted at the app that initiated the download, so it seems you can't catch other apps' downloads...

Foolish answered 3/10, 2014 at 9:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.