我正在使用TransferUtility
将大文件上传到S3。(https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/s3-integration-transferutility.html)
任何人都可以确认TransferUtility
为此创建自己的Android Service
吗?
文件很大,我需要在Android Service
中执行上传,以免该应用被杀死。TransferUtility
公开了一个异步API,但尚不清楚它是否创建Android Service
。
过去,我以前使用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()
}
}