Error while trying to upload / download file using Amazon Mobile SDK for Android

I am trying to upload / download a file using Amazon Mobile SDK Android. I created my bucket, in the permissions I set, so everyone can read and write. In amazon Cognito, I left everything as default.

I get this error when uploading any file ...

 Process: com.example.jghg.awsamazon, PID: 2815
java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:300)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
 Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: Forbidden (Service: Amazon S3; Status Code: 403; Error Code: null; Request ID: BC4D4A7771B45D79), S3 Extended Request ID: 45vc24DJDdMjNK11V+dYx103RwFxYPJO9AU4MYa4q3dzfH6R2Vh5iVuViBWv8TDZ
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(Unknown Source)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(Unknown Source)
        at com.amazonaws.http.AmazonHttpClient.execute(Unknown Source)
        at com.amazonaws.services.s3.AmazonS3Client.invoke(Unknown Source)
        at com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(Unknown Source)
        at com.amazonaws.mobileconnectors.s3.transfermanager.TransferManager.doDownload(Unknown Source)
        at com.amazonaws.mobileconnectors.s3.transfermanager.TransferManager.download(Unknown Source)
        at com.amazonaws.mobileconnectors.s3.transfermanager.TransferManager.download(Unknown Source)
        at com.example.jghg.awsamazon.ConnecToAWS.doInBackground(ConnecToAWS.java:67)
        at com.example.jghg.awsamazon.ConnecToAWS.doInBackground(ConnecToAWS.java:20)
        at android.os.AsyncTask$2.call(AsyncTask.java:288)

      

This is my code.

 @Override
protected Void doInBackground(Void... params) {

    cognitoProvider = new CognitoCachingCredentialsProvider(
            context, 
            "15743803132",
            "us-east-1:9a873c64-a61b-4871-ab3c-57d77e3be02",
            "arn:aws:iam::157438031324:role/Cognito_AndroidTestUnauth_DefaultRole",
            "arn:aws:iam::157438031324:role/Cognito_AndroidTestAuth_DefaultRole",
            Regions.US_EAST_1
    );


    CognitoSyncManager syncClient = new CognitoSyncManager(
            context,
            "us-east-1:6a873c64-a61b-4871-ab3c-57d77e3be024",
            Regions.US_EAST_1,
            cognitoProvider);

    TransferManager transferManager = new TransferManager(cognitoProvider);

    Log.e(LOG_TAG,"Data " + cognitoProvider.getIdentityId());


    File file = new File(Environment.getExternalStorageDirectory()
            +File.separator
            +"myDirectory" //folder name
            +File.separator
            +"myFile");

    Download download = transferManager.download(BUCKET_NAME, key, file);


    return null;

      

My question is, what is the key ?

Thanks everyone.

+3
android amazon-s3 amazon-web-services


source to share


No one has answered this question yet

Check out similar questions:

964
Download file from Android and show progress in ProgressDialog
632
Trying to SSH into Amazon Ec2 instance - permission error
1
How to add a user to a role
1
Can't create handler inside thread that didn't call Looper.prepare () - Google Translate
0
unable to load image from gallery
0
Android APP, Catlog Alarm Messages, Topic Exception
0
Json error in logcat file in aysnc task
0
Java error on Android when accessing shared preferences for multiple parts download
0
Apk export error
-2
java.lang.RuntimeException: An error occurred while executing doInBackground () using Kotlin



All Articles
Loading...
X
Show
Funny
Dev
Pics