Data Persistence

Brian Milby brian at milby7.com
Mon Jul 23 18:21:08 EDT 2018


I built a time tracking app that had the same type of persistence requirement. I used a text file for the data store. Each time any field had a change, the data was saved again. When loading the app it would import the current data. Data was only cleared on request (and I would only allow that after it was emailed). When cleared, I deleted the file.

As you have discovered, on mobile your app can be terminated at any time and you may not be given a chance to save data before then.

My test was on iOS but it should work the same on Android.

Thanks,
Brian
On Jul 23, 2018, 4:58 PM -0500, John McKenzie via use-livecode <use-livecode at lists.runrev.com>, wrote:
>
>
> Hello, all.
>
> I am new to Livecode development but not computing. When I heard of
> something that was inspired by Hypercard I had to know more. Used
> Livecode to make a little app on my phone for work but the level of
> interest this app generated now make me want to finish it, and maybe
> even share and/or sell it. Livecode is pretty cool and I am looking
> forward to learning how to use it and do stuff with it.
>
> So my first (and I sadly suspect not last) question to the list is
> about persistence on the Android platform.
>
> My job is in the aviation industry. For now I want to get it working.
> Then I will polish it off, beta test it, etc. One airline rep gave me
> his card and said to call him about it if I wanted to sell it.
>
> The get it working part is where I need your help. I was unclear on
> what Livecode could and could not do so I emailed them and a very
> helpful person named Heather educated me a bit. Now that I know it
> might work for my application I would appreciate your help in getting
> it working.
>
> Right now it will be an Android app. iOS app later probably.
>
> The app is to help me record times and other facts about plane
> landings (like when the plane landed and how much fuel is requested by
> the Captain). At the end of a flight I can press a button and an email
> addressed to our operations centre is auto-populated in the body of the
> text with these numbers. For example if I press the button labelled
> "ATA" (actual time of arrival) it places the current time in the text
> field next to the ATA button. I can touch the text field and edit the
> time if need be.
>
> What I need help with is the issue of persistence. If I get an SMS
> message, a phone call or an alarm goes off the data will be wiped out
> when I return to the app. Sometimes if I leave the app to check
> something else and come back the data is there and other times the text
> fields are all blank. Tried saving the data in a text file and having
> the app load it up each time it starts. Most of the time this does not
> work. Usually when I start the app up again at the beginning of the
> next shift it starts up with the times of yesterday's flight.
>
>
> So I would like to know how to properly hold the data so the entries
> in the text fields are still there when I go to another app then come
> back to mine. looking to have basic persistence in my app.
>
> Guidance on the (or one of the) proper way(s) to accomplish this
> would be most appreciated.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list