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 » Wed Sep 20, 2017 1:35 pm

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: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Saving user data

Post by jacque » Wed Sep 20, 2017 4:53 pm

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 » Wed Sep 20, 2017 9:31 pm

Thanks. Good tip about the back key.

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Saving user data

Post by MaxV » Fri Sep 29, 2017 5:16 pm

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: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Saving user data

Post by jacque » Fri Sep 29, 2017 5:50 pm

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: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Saving user data

Post by MaxV » Wed Oct 04, 2017 1:09 pm

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: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Saving user data

Post by mrcoollion » Wed Oct 04, 2017 2:45 pm

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

Regards,

Paul

Post Reply

Return to “Android Deployment”