Saving user data
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Saving user data
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
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
-
- VIP Livecode Opensource Backer
- Posts: 7266
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Saving user data
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.
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
HyperActive Software | http://www.hyperactivesw.com
Re: Saving user data
Thanks. Good tip about the back key.
Re: Saving user data
On closeStack ??cwkalish wrote:Thanks. Good tip about the back key.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 7266
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Saving user data
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.MaxV wrote:On closeStack ??cwkalish wrote:Thanks. Good tip about the back key.
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
HyperActive Software | http://www.hyperactivesw.com
Re: Saving user data
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
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- Posts: 722
- Joined: Thu Sep 11, 2014 1:49 pm
- Location: The Netherlands
Re: Saving user data
Maybe an idea to use an SQLite Database for your app?
Regards,
Paul
Regards,
Paul