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
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.
First register the reciever
registerReceiver(onComplete,
new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
And set a BroadcastReciever to capture the event.
BroadcastReceiver onComplete=new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
// run your action here
}
};
Probabily your receiver is declared with lower priority than the registered for the Market application. Try to use IntentFilter.setPriority() or declare the priority on XML here