android firebase file upload in background service stopped when clear app from recents.
还没有人认领这个 Issue。
评估
调研方向
从 issue 中的 NotificationJobService 示例开始,重点查看 onStartJob 和 onStopJob,并追踪当应用从最近使用的应用中移除时 UploadFileToServer 是如何创建和取消的。payload 没有指定 repository 文件或测试;完成的标准是,应用从最近使用的应用中移除后,后台上传及其通知仍会继续,或以可见的方式失败。
由索引模型根据 Issue 内容生成。
描述
Step 1: Are you in the right place?
- For issues or feature requests related to the code android storage file a Github issue.
Step 2: Describe your environment
- Android device: _____Mi note5
- Android OS version: _____oreo
- Google Play Services version: _____
- Firebase/Play Services SDK version: _____
Step 3: Describe the problem:
I have used your code for file upload in background service. It works fine when the app is running. but when the app is removed from recent apps or get killed then the uploading and notification stopped and remains as it is.
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class NotificationJobService extends JobService implements UploadFileToServer.UploadEventListener {
private JobStartedListner jobStartedListner;
ArrayList<File> sourceFileList = new ArrayList<File>();
UploadFileToServer uploadFileToServer;
@Override
public void onPreExecute() {
}
@Override
public void onComplete() {
}
@Override
public void onProgressUpdated(Integer progress, int totalSize, int currentFilePosition) {
}
public interface JobStartedListner {
public void onJobStarted();
}
public NotificationJobService() {
}
@Override
public boolean onStartJob(JobParameters jobParameters) {
Log.e("Job Params", jobParameters.toString());
String[] data = jobParameters.getExtras().getStringArray("data");
for (int i = 0; i < data.length; i++) {
if (data[i] != null) {
File f = new File(data[i]);
sourceFileList.add(new File(data[i]));
}
}
uploadFiles(this, sourceFileList, this);
return false;
}
public void uploadFiles(UploadFileToServer.UploadEventListener uploadEventListener, ArrayList<File> sourceFileList, Context context) {
uploadFileToServer = new UploadFileToServer(uploadEventListener, /*new File(imagepath)*/sourceFileList, context);
}
@Override
public boolean onStopJob(JobParameters jobParameters) {
uploadFileToServer.cancel(true);
return true;
}
}
- 主要语言
- Kotlin
- 星标
- 9.3k
- 派生
- 7.4k
- 平均合并
- 7 天 9 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/quickstart-android 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
firebase/quickstart-android#2756 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
firebase/quickstart-android#2754 · 5 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 32/100
firebase/quickstart-android#2668 ·
-
难度 4/5 3-5 天 新手友好度 25/100
firebase/quickstart-android#2663 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
firebase/quickstart-android#1669 · 3 条评论 ·
查看 firebase/quickstart-android 的全部 Issue
相似的 Issue
-
android:plan main:plan packages:learn
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
Needs Triage
难度 2/5 1-3 小时 新手友好度 72/100
ankidroid/Anki-Android#23453 ·
维护者通常 1 天内回复
-
afk-ok area:data-quality importer size:S
难度 2/5 1-3 小时 新手友好度 78/100
enorm-labs/event-junkie#5278 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
bazel-contrib/rules_kotlin#1846 ·
维护者通常 2 天内回复