下载到内部存储时显示在通知栏中吗?
在 Android 上,当您将文件下载到 SD 时,顶部会显示一个显示进度的通知栏。现在,我必须将文件下载到手机的内部存储中 - 其他应用程序将无法访问该文件。
问:是否可以显示这样的通知,让用户可以停止下载?如何?
我在这里想做的是允许用户在下载文件时执行其他操作。有什么想法吗?
On Android, when you download files to the SD, a notifiation bar showing the progress can be seen at the top. Now, I must download a file to the internal storage of my phone - where it will be inaccessible to other apps.
Q: Is it possible to show such a notification where the user can stop the download? How?
What I'm trying to do here is to allow the user to do other stuff while downloading the file. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简而言之:您必须自己构建通知,请参阅文档 了解详情。
Long:如果我理解正确,那么 DownloadManager 会处理将通知放入栏中。但该界面看起来有些有限,因为文档仅讨论 HTTP 下载,并且似乎只有设置外部存储路径的选项。
因此,如果我是正确的,您将无法使用 DownloadManager,因此您不会免费收到通知。您必须自己实施它们。
Short: You have to build the notification by yourself, see the docs for details.
Long: If I have understood it right then the DownloadManager would take care of putting a notification into the bar. But the interface looks somewhat limited as the documentation only talks about HTTP downloads and only seem to have options to set a path to external storage.
So if I'm correct you can't use the DownloadManager, so you don't get the notifications for free. You would have to impplement them by yourself.