fluttercommunity / fluttercommunity/flutter_uploader
Uploading stops when the device is locked.
- Dominant language
- Dart
- Stars
- 218
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
**The case:**
I want to make my app uploading 500-1000 images in the background even when the device is locked. Everything works fine when the app is in the foreground.
**The issue:**
When I lock the device, I don't receive any events neither in Flutter nor in native. Now it is impossible to debug the Flutter iOS app when the device is locked. Thus, I am trying to debug the native one.
The code for scheduling uploading on the Flutter side:
```dart
await Future.wait(notUploadedPhotos.map((photo) async {
final taskId = await uploader.enqueue(
MultipartFormDataUpload(
url: '${rowService.apiClient.environment.baseUrl}photos/',
files: [FileItem(path: '$basePath${photo.path!}', field: 'file')],
method: UploadMethod.POST,
headers: {'Authorization': 'Bearer $token'},
allowCellular: allowCellular,
),
);
await galleryService.updatePhoto(photo.copyWith(taskId: taskId));
}));
```
**The background:**
- I tried to set the breakpoints in Xcode and don't receive anything after a while. I don't receive any errors at all.

- Do we need to disable `Data protection` for the app or set a specific level? I saw some problems with those settings on stackoverflow.com but not sure that it is a key
- Sometimes the app crashes when I try to create a task with 1000 files or 1000 tasks. Looks like related to https://github.com/fluttercommunity/flutter_uploader/pull/209
- I saw the same question previously without response: https://github.com/fluttercommunity/flutter_uploader/issues/165 about background uploading
- Did I miss something? There is nothing special for ios in the readme. Maybe I don't know what I need to set up to make it work?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.