I'm working with CloudRail in order to upload/download files from dropbox to my android device. I don't know how to implement the upload or the download methods. I'm getting lost with the file path directories when it comes to create a simple files.txt to upload.
What I would like to do is write/read a simple String variable into a file.txt and upload it to dropbox. Creating the files in the external memory of the device and then uploading them would be an option too.
I have also made some research with CloudRail samples at GitHub, but there's a lot of code regarding the visual interface, which I don't need, and makes it difficult for me to find a solution. I also found some related post to my needs, but I couldn't reproduce it. Moreover, I posted in the CloudRail forum with no replies.
Thank you in advance for your time
private void uploadItem(final String name, final Uri uri) {
startSpinner();
new Thread(new Runnable() {
@Override
public void run() {
InputStream fs = null;
long size = -1;
try {
fs = getOwnActivity().getContentResolver().openInputStream(uri);
size = getOwnActivity().getContentResolver().openAssetFileDescriptor(uri, "r").getLength();
} catch (Exception e) {
stopSpinner();
getOwnActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(context, "Unable to access file!", Toast.LENGTH_SHORT).show();
}
});
return;
}
String next = currentPath;
if(!currentPath.equals("/")) {
next += "/";
}
next += name;
getService().upload(next, fs, size, true);
getOwnActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateList();
}
});
}
}).start();
}