File upload does not work with TransferUtility Amazon S3 on Android

Hi, I tried uploading a dummy text file to Amazon S3. however it does not work, but the log generated an identifier. When I update the dashboard of Amazon S3. file was not transferred.

public class AmazonService extends AsyncTask<String, Boolean, Boolean> { Context mContext; public AmazonService(Context context) { mContext = context; } @Override protected Boolean doInBackground(String... params) { CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider( mContext, "us-east-1:ec361bf5-52b9-477b-9a68-7e2b5f70de07", // Identity Pool ID Regions.US_EAST_1 // Region ); AmazonS3Client client = new AmazonS3Client(credentialsProvider); TransferUtility transferUtility = new TransferUtility(client, mContext); TransferObserver observer = transferUtility.upload("elevator-app","Video/",new File("dummy.txt") ); Log.d("Test", observer.getId() + " " + observer.getBytesTransferred()); return true; } } 

// Service required for AndroidManifest.xml

 <service android:name= "com.amazonaws.mobileconnectors.s3.transferutility.TransferService" android:enabled="true" /> 
+5
source share
1 answer

I had the same problem, the reason is because I put the service tag outside the application tag. When I put the service tag inside the application tag, everything worked perfectly.

+9
source

All Articles