Native cloud storage
John Craig
john at splash21.com
Thu Feb 21 15:45:03 EST 2013
As part of a commercial app I'm working on, there is a requirement for
basic cloud storage, so I've created a simple, native LC cloud storage
service for storing app data as required.
If there are a few interested volunteers that are in a position to give
it a test run, then drop me a quick line off list.
Best,
John.
--- More info ---
It's a small, open source button script that you can simply plug in or
copy into your app.
It will work with all LC platforms - Mac/Win/Linux/iOS/Android.
The service is based around a native LC REST API.
Storage limits can be configured per user.
All communication is straight HTTP, so no issues should arise with Apple
re. encryption.
User credentials are safe - they aren't visible in any communication
with the server.
You can insert the button script into the back scripts or just paste the
code into your stack, etc.
The syntax is simple.
-- Initialize the service with your account details;
cloud.Start tEmail, tPassword
-- Fetch account storage stats: used / limit / percentage;
put cloud.Stats() into tData
-- Store data examples;
cloud.Store "MyData", "12345"
cloud.Store "com.domain.app.machine.key", "ABC-DEF-GHI"
-- Fetch stored data examples;
put cloud.Fetch("MyData") into tData
put cloud.Fetch("com.domain.app.machine.key") into tData
-- Delete data
cloud.Delete "MyData"
In addition, a quick tweak allowed storage of 'shared' info - high
scores in this example. This allows multiple app instances all to post
scores simultaneously and the server will look after the data and keep
it in sync - also keeping only the top N records. If this works as
expected, it could be really useful to allow this sharing for all types
of data.
-- Post a score. This example posts to the app's high score table.
-- pScore is the actual score, pData could be the user name, etc. -
anything associated with the score
-- the last parameter instructs the server to only keep hold of the
top 10 records.
cloud.Score "com.domain.app.hiScores", pScore, pData, 10
-- Fetch high scores
put cloud.FetchScores("HiScores") into tHiScores
-- Delete the high scores
cloud.DeleteScores "HiScores"
More information about the use-livecode
mailing list