Я создал приложение на MobileHub и интегрировал для Android.Файл конфигурации находится в сыром каталоге.
После вызова
AWSMobileClient.getInstance().initialize(context).execute();
BasicAWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY, KEY_SECRET);
AmazonS3Client s3Client = new AmazonS3Client(credentials);
transferUtility = TransferUtility.builder()
.context(context.getApplicationContext())
.awsConfiguration(AWSMobileClient.getInstance().getConfiguration())
.s3Client(s3Client)
.build();
TransferObserver uploadObserver =
transferUtility.upload(
BUCKET_NAME,
file.getName(),
file);
uploadObserver.setTransferListener(new TransferListener() {
@Override
public void onStateChanged(int id, TransferState state) {
System.out.println("State changed:"+state);
}
@Override
public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
System.out.println("Progress.."+bytesCurrent);
}
@Override
public void onError(int id, Exception ex) {
System.out.println("error:"+ex);
}
});
я получаю
Welcome to AWS! You are connected successfully.
AWSMobileClient Initialize succeeded.
Но когда я пытаюсь загрузить любой файл (из общего каталога ии оба), он срабатывает только один раз на ProgressChanged с TransferState как IN_PROGRESS.И ничего больше.
Если невозможно загрузить изображение, не должно ли быть правильной ошибки?
Мой Logcat:
06-12 14:22:41.873 I: Welcome to AWS! You are connected successfully.
06-12 14:22:41.873 D: AWSMobileClient Initialize succeeded.
06-12 14:22:41.873 I: Welcome to AWS! You are connected successfully.
06-12 14:22:41.877 I: registering receiver
06-12 14:22:41.955 I: State changed:IN_PROGRESS
06-12 14:22:41.960 W: finishComposingText on inactive InputConnection
finishComposingText on inactive InputConnection
finishComposingText on inactive InputConnection
06-12 14:22:46.844 V: Inactivity, disconnecting from the service
06-12 14:22:46.845 I: Sending crashes
06-12 14:23:18.221 V: Recording user engagement, ms: 36408
06-12 14:23:18.223 V: Connecting to remote service
06-12 14:23:18.230 V: Activity paused, time: 22740592
06-12 14:23:18.237 D: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=36408, firebase_screen_class(_sc)=AdminActivity, firebase_screen_id(_si)=-1968217097067733732}]