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 天內回覆