Saving user data

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cwkalish
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Thu Sep 30, 2010 2:24 am

Saving user data

Post by cwkalish »

Hi.
Is there a best practice for recording user data in an android app? My concern is that users are able to quit the app at any point (I assume there is no way to disable the back/pause/quit buttons on the screen?).

If I write to a file frequently, do I run the risk of having the app quit with the file open (and corrupting it)?

Thanks for any guidance.

-Chuck
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Saving user data

Post by jacque »

You can intercept the back key but not the other two. A backKey message is sent for that one.

On Android you have to expect the app to be removed from RAM at any time, so you should close the file after every write. Opening and closing files is very fast and will be unnoticeable. Or you can use the URL form to do everything in one line, though that method offers slightly less control.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
cwkalish
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Thu Sep 30, 2010 2:24 am

Re: Saving user data

Post by cwkalish »

Thanks. Good tip about the back key.
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Saving user data

Post by MaxV »

cwkalish wrote:Thanks. Good tip about the back key.
On closeStack ??
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Saving user data

Post by jacque »

MaxV wrote:
cwkalish wrote:Thanks. Good tip about the back key.
On closeStack ??
I wish. The Home and App Switcher keys send no messages at all. No closeStack, closeCard, shutdown, nothing. Those actions are sent directly to the OS and the app never knows you pressed those buttons.

We really need to get suspend and resume messages for those keys but LC says they haven't been able to make it work yet. I hope they can solve it soon.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Saving user data

Post by MaxV »

Probably is the shutdown message to use with app, see http://newsletters.livecode.com/novembe ... etter4.php
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

Re: Saving user data

Post by mrcoollion »

Maybe an idea to use an SQLite Database for your app?

Regards,

Paul
Post Reply