我正在尝试在我的应用程序中使用 android 默认下载管理器,但问题是下载完成后我的应用程序中没有收到任何消息。 有什么办法可以解决这个问题吗?
最佳答案
您需要注册一个 BroadcastReceiver 才能知道它何时完成:
registerReceiver(completionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
接收者:
BroadcastReceiver completionReceiver = new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
//here You know the download is complete, do whatever You want to do
}
};
关于android - 下载完成时收到消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23889721/