【发布时间】:2016-10-18 09:01:34
【问题描述】:
我有注册到 android.intent.action.DOWNLOAD_COMPLETE 的接收器。
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<receiver
android:name="com.myapp.listener.DownloadListenerService"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
</intent-filter>
</receiver>
它是我的接收者 DownloadListenerService.java:
package com.myapp.listener;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class DownloadListenerService extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("MYAPP","Start DownloadListenerService");
//some code
}
}
只有在下载完成后,我才会在 logcat 消息中看到“Start DownloadListenerService”。但是,如果下载在下载管理器中获取状态不成功,我在 logcat 中看不到任何消息。我怎样才能发现我的下载没有下载?
【问题讨论】:
标签: java android android-intent broadcastreceiver android-download-manager