android - 如何访问 IntentService 的队列?

标签 android service intentservice

我有一项 Activity 将多个上传进程放入 IntentService 的队列中。现在我想显示一个待处理和已开始上传的列表,以及一个停止上传的按钮。

基于这个问题Asking an IntentService for information about its queue我开始实现外部队列,但到目前为止我还不知道如何停止特定任务。

有没有更好的方法来管理 IntentService 的队列?

最佳答案

在您的 IntentService 中注册 BroadCastReceiver("stopUpload") 以在收到此 Intent 时停止上传。从您的 Activity 的 sendBroadcast("stopUpload") 触发该 Intent 。

关于android - 如何访问 IntentService 的队列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7873831/

相关文章:

java - 在 Android 的 IntentService 中等待异步回调

AsyncTask 中的 Android AlertDialog

android - 错误 : cannot find symbol method getDownloadUrl() of type com. google.firebase.storage.UploadTask.TaskSnapshot

java - 我可以写入不属于我的应用程序的文件夹(data/data/com.glob.etc)-java(android)吗?

android - START_STICKY,前台 Android 服务消失,恕不另行通知

java - 服务在应用程序关闭时停止,而以前没有

android - 使用没有 Activity 的服务的媒体按钮(耳机 Hook )的监听器

android - 如何在 Intent Service 中获取 Activity

android - 在 xml 之外应用布局属性有什么缺点?

Android 服务无法启动,因为来自一个甚至不再存在的类的 ClassNotFoundException