I was previously trying this with com.amazonaws:aws-android-sdk-s3:2.2.13 but now I'm using com.amazonaws:aws-android-sdk-s3:2.2.16
I don't know why none of the callbacks in transfer listener ever gets called..
AmazonS3 s3 = S3Utils.getS3Client(UploadActivity.this);
mTransferUtility = new TransferUtility(s3, UploadActivity.this);
File file = new File(media.getUri().getPath());
final String fileName = MD5.calculateMD5(file);
final String bucketName = MyApplication.getInstance().getString(R.string.S3_BUCKET_NAME);
TransferObserver observer = mTransferUtility.upload(bucketName, fileName, file);
observer.setTransferListener(new TransferListener() {
..
..
});
I don't know even if the upload actually begins or not but when I try to cancel it gets cancelled as expected.
boolean canceled = mTransferUtility.cancel(observer.getId());
if (canceled) {
mTransferUtility.deleteTransferRecord(observer.getId());
}
When I try to run the same code in your sample app that is working fine.. What is it that I'm missing here or is this a bug in SDK??
Found the issue.. declared the service in manifest file.. my bad
<service android:name="com.amazonaws.mobileconnectors.s3.transferutility.TransferService"
android:enabled="true" />
But it would be nice if you could add this in readme or doc. Thanks
Added the service, however Service still is not calling my listener
@justdan0227 Make sure you put the service declaration inside the
I made a mistake putting it outside and so couldn't get it to work either.
Most helpful comment
Found the issue.. declared the service in manifest file.. my bad
<service android:name="com.amazonaws.mobileconnectors.s3.transferutility.TransferService"android:enabled="true" />But it would be nice if you could add this in readme or doc. Thanks