如何注册接收器以捕获完成的下载?

时间:2013-02-22 22:29:27

标签: android receiver

我正在检查一些关于如何在DownloadManager完成下载时通知接收器的教程,他们像这样注册接收器

context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); 

虽然,我想在我的manifest.xml注册接收器而不是实用,我发现人们正在这样做

<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> 

那么 android.intent.action.DOWNLOAD_COMPLETED DownloadManager.ACTION_DOWNLOAD_COMPLETE 之间有什么不同?为什么他们不在清单中使用<action android:name="DownloadManager.ACTION_DOWNLOAD_COMPLETE" />

0 个答案:

没有答案