AppStudio 4: Working with Dropbox

AppStudio 4.0 allows your mobile app to share data with other computers using Dropbox.

(If you haven’t used Dropbox, it’s an easy to use cloud based filing system. It is very nicely integrated with Windows and Mac: it becomes just another folder on your system. Dropbox takes care of all the behind the scenes file transferring, and it’s free with a reasonable amount of storage.)

You can create, read, update and delete files in your Dropbox folder using AppStudio. This makes it a powerful tool for synching data between your device and the desktop. It even works offline: the files you create or update will be synced with the desktop next time there is a data connection.

There are two types of data:

  • Data Files: Work like conventional data files on the desktop. Operations on these read and write the entire file.
  • Data Stores: A simple database where you can access your file on a record by record basis. DropBox has dropped support for Data Stores

Your data is secure. Your app needs to be registered with DropBox (easy to do) and OAuth authorization has be completed before accessing it.

Data Files

'Read a file. 
'When complete, the readComplete function is called with the data.
client.readFile("MyData.txt", {}, readComplete)  

Function readComplete(errdata)
  MsgBox "Data read: " & data
End Function

'Write a file
s="This is my data"
client.writeFile("MyData.txt"s, {}, writeComplete)

Function writeComplete(err)
  MsgBox "Data written. Error: " & err
End Function

For complete documentation, see this Tech Note. There is also a sample in Folder 6: “StudentsDropboxFile”, which maintains a simple list of names.