Skip to content

Uploading stops when the device is locked. #220

Open
@w3ggy

Description

@w3ggy

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:

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.
image
  • 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 Fix unbounded memory usage #209
  • I saw the same question previously without response: Background upload in ios using version 3 #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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions