public static void uploadToS3(TransferManager transferManager, final File file, final FileProgressListener fileProgressListener) throws InterruptedException { PutObjectRequest putObjectRequest = new PutObjectRequest("car-classifieds", file.getName(), file) .withCannedAcl(CannedAccessControlList.PublicRead); final Upload upload = transferManager.upload(putObjectRequest); upload.addProgressListener(new ProgressListener() { @Override public void progressChanged(ProgressEvent progressEvent) { fileProgressListener.onProgressChanged(progressEvent.getBytesTransferred()); if (progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) { fileProgressListener.onCompleteUpload(); } if (progressEvent.getEventCode() == com.amazonaws.event.ProgressEvent.STARTED_EVENT_CODE) { fileProgressListener.onStartUpload(); } if (progressEvent.getEventCode() == com.amazonaws.event.ProgressEvent.FAILED_EVENT_CODE) { fileProgressListener.onFailedUpload(); } } }); }
public static void init(Context context) { provider = new CognitoCachingCredentialsProvider(context, AWS_ACCOUNT_ID, COGNITO_POOL_ID, COGNTIO_ROLE_UNAUTH, COGNITO_ROLE_AUTH, Regions.US_EAST_1); //initialize the clients cognitosync = new CognitoSyncManager(context, Regions.US_EAST_1, provider); manager = new TransferManager(provider); ddb = new AmazonDynamoDBClient(provider); //ddbmapper = new DynamoDBMapper(ddb); analytics = MobileAnalyticsManager.getOrCreateInstance(context, MOBILE_ANALYTICS_APP_ID, Regions.US_EAST_1, provider); kinesis = new KinesisRecorder(context.getDir(KINESIS_DIRECTORY_NAME, 0), Regions.US_EAST_1, provider); lambda = new LambdaInvokerFactory(context, Regions.US_WEST_2, provider); }
public static void uploadToS3(TransferManager transferManager, final File file) throws InterruptedException { PutObjectRequest putObjectRequest = new PutObjectRequest("car-classifieds", file.getName(), file) .withCannedAcl(CannedAccessControlList.PublicRead); final Upload upload = transferManager.upload(putObjectRequest); upload.addProgressListener(new ProgressListener() { @Override public void progressChanged(ProgressEvent progressEvent) { if (progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) { } } }); }
public static TransferManager getTransferManager(Context context) { CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider( context, "us-east-1:c2432cb5-55e1-42ec-a12f-4be2bc8abd9a", Regions.US_EAST_1 ); TransferManager transferManager = new TransferManager(credentialsProvider); return transferManager; }
public S3BroadcastManager(Broadcaster broadcaster, AWSCredentials creds) { // XXX - Need to determine what's going wrong with MD5 computation System.setProperty("com.amazonaws.services.s3.disableGetObjectMD5Validation", "true"); mTransferManager = new TransferManager(creds); mBroadcaster = broadcaster; mQueue = new LinkedBlockingQueue<>(); mInterceptors = new HashSet<>(); new Thread(this).start(); }
public static void init(Context context) { provider = new CognitoCachingCredentialsProvider(context, AWS_ACCOUNT_ID, COGNITO_POOL_ID, COGNTIO_ROLE_UNAUTH, COGNITO_ROLE_AUTH, Regions.US_EAST_1); //initialize the Cognito Sync Client //initialize the Other Clients manager = new TransferManager(provider); analytics = MobileAnalyticsManager.getOrCreateInstance(context, "App_ID_Here", Regions.US_EAST_1, provider); }
public static TransferManager getManager() { if (manager == null) { throw new IllegalStateException("client not initialized yet"); } return manager; }