Fork us on GitHub

Cloud Files

Cloud files are a great pro feature that we didn't emphasize ...
Post Image

Cloud Files

Cloud files are a great pro feature that we didn't emphasize enough, its remarkably useful. It allows you to upload a file into the cloud which you can then transfer to anyone thru a simple "obfuscated" URL. The URL is long so the probability of someone guessing it is low, hence its pretty secure for private file transfer (if its really private you should use bouncy castle ). The API couldn't be simpler:

String fileId = CloudStorage.getInstance()
.uploadCloudFile(mimeType, fileName);

This will block to upload the file so you might want to display an infinite progress indicator or something, once its done and the file was uploaded you can just call:
String url = CloudStorage.getInstance(). getUrlForCloudFileId ( fileId);

That URL will provide you with the file download and you can delete the file via deleteCloudFile(fileId). In the upcoming version we are also adding deleteAllCloudFilesForUser() and deleteAllCloudFilesBefore(timestamp, developerAccount, developerPassword)
which will allow you to purge some of your quota.

You can use this for image exchange and other such tricks but one of my favorite concepts is sharing data between devices e.g. you can upload your application state as a file to the cloud and expose it via a QR code like this:
int size = Math.min(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight());
Label qrCode = new Label(new URLImage("" + size + "x" + size "&chl=" + fileId + "&chld=H|0"));

Now on the other device just scan the QR code and download the file to import the data, trivial synchronization between devices without typing a single word into the device!

The image you see on the right is a bit unrelated but you might find it interesting... A corporate account requested native Google Maps support for iOS/Android, we already have a prototype on iOS although Android is a bit more of a challenge. We hope to have something to show soon though.

Notice: This post was automatically converted using a script from an older blogging system. Some elements might not have come out as intended.... If that is the case please let us know via the comments section below.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.