Page 1 of 1
Saving user data
Posted: Wed Sep 20, 2017 1:35 pm
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
Re: Saving user data
Posted: Wed Sep 20, 2017 4:53 pm
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.
Re: Saving user data
Posted: Wed Sep 20, 2017 9:31 pm
by cwkalish
Thanks. Good tip about the back key.
Re: Saving user data
Posted: Fri Sep 29, 2017 5:16 pm
by MaxV
cwkalish wrote:Thanks. Good tip about the back key.
On closeStack ??
Re: Saving user data
Posted: Fri Sep 29, 2017 5:50 pm
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.
Re: Saving user data
Posted: Wed Oct 04, 2017 1:09 pm
by MaxV
Re: Saving user data
Posted: Wed Oct 04, 2017 2:45 pm
by mrcoollion
Maybe an idea to use an SQLite Database for your app?
Regards,
Paul