【问题标题】:Does `TransferUtility` from the android Amazon AWS Mobile SDK run in its own `Service`?android Amazon AWS Mobile SDK 中的`TransferUtility` 是否在其自己的`Service` 中运行?
【发布时间】:2019-11-12 13:50:04
【问题描述】:

我正在使用TransferUtility 将大文件上传到 S3。 (https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/s3-integration-transferutility.html)

谁能确认TransferUtility为此创建了自己的Android Service

文件很大,我需要在 Android Service 中执行上传以避免应用程序被杀死。 TransferUtility 公开了一个异步 API,但不清楚它是否创建了 Android Service

【问题讨论】:

    标签: android amazon-s3 android-service aws-sdk awss3transferutility


    【解决方案1】:

    过去,当我使用 AWS 时,我总是将调用封装在 JobScheduler 中。但您可能应该将其包装在 WorkManager 中。

    public class UploadWorker extends Worker {
    
        public UploadWorker(
            @NonNull Context context,
            @NonNull WorkerParameters params) {
            super(context, params);
        }
    
        @Override
        public Result doWork() {
          // Do the work here.
    
          transferLargeFilesToAws()
    
          // Indicate whether the task finished successfully with the Result
          return Result.success()
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2016-03-15
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 1970-01-01
      • 2021-08-21
      • 2013-08-31
      • 2021-05-10
      • 1970-01-01
      相关资源
      最近更新 更多