use of com.backendless.files.router.FileOutputStreamRouter in project Android-SDK by Backendless.
the class UploadFileAsyncTask method doInBackground.
private void doInBackground(final File file, final String path) {
final AsyncUploadMessage asyncUploadMessage = new AsyncUploadMessage(uploadCallback);
ThreadPoolService.getPoolExecutor().execute(new Runnable() {
@Override
public void run() {
try {
FileOutputStreamRouter fileOutputStreamRouter = new FileOutputStreamRouter(file, new UploadCallback() {
public void onProgressUpdate(Integer progress) {
asyncUploadMessage.setCurrentProgress(progress);
ResponseCarrier.getInstance().deliverMessage(asyncUploadMessage);
}
});
BackendlessFile result = Backendless.Files.uploadFromStream(fileOutputStreamRouter, file.getName(), path, overwrite);
ResponseCarrier.getInstance().deliverMessage(new AsyncMessage<BackendlessFile>(result, responder));
} catch (Exception e) {
ResponseCarrier.getInstance().deliverMessage(new AsyncMessage<BackendlessFile>(new BackendlessFault(e), responder));
}
}
});
}
Aggregations