Highlighted

Mobile: persisting data after installs

Engaged ,
Jul 02, 2014

Copy link to clipboard

Copied

I'm using Flash Pro CC 2014 and I noticed that every time I publish to my device (Google Nexus 4) all saved data gets wiped. This includes both SharedObject and LocalEncryptedStore. I have two questions about this:

1. Will this be the effect when end users update the app? I've heard about people having issues with saved data getting wiped for their users after they updated the app. According to this article SharedObject is good to use, but it's not clear to me from the article if that state data would persist after an update.

2. If this is unique to development (ie something about the debug install which wipes data that wouldn't normally be wiped) is there a way to avoid it and have data persist? I'd like to keep at least some data related to apps I'm working on!

Thanks!

- Aaron

TOPICS
Development

Views

285

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Mobile: persisting data after installs

Engaged ,
Jul 02, 2014

Copy link to clipboard

Copied

I'm using Flash Pro CC 2014 and I noticed that every time I publish to my device (Google Nexus 4) all saved data gets wiped. This includes both SharedObject and LocalEncryptedStore. I have two questions about this:

1. Will this be the effect when end users update the app? I've heard about people having issues with saved data getting wiped for their users after they updated the app. According to this article SharedObject is good to use, but it's not clear to me from the article if that state data would persist after an update.

2. If this is unique to development (ie something about the debug install which wipes data that wouldn't normally be wiped) is there a way to avoid it and have data persist? I'd like to keep at least some data related to apps I'm working on!

Thanks!

- Aaron

TOPICS
Development

Views

286

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 02, 2014 0
Participant ,
Jul 03, 2014

Copy link to clipboard

Copied

Hi Aaron,

SharedObjects should be good to use. We use them on our apps and data persists between updates.

I'm mainly working with iOS rather than Android though.

For iOS, I have a notion that if you install via iTunes the data persists but if you publish to device from Flash it gets cleared. So to keep data in the dev environment I used to do an adhoc build and deploy via iTunes (but haven't tried this recently).

It may behave similarly on Android so thought it was worth sharing.

All the best !

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2014 0
Contributor ,
Jul 03, 2014

Copy link to clipboard

Copied

If you install via USB publishing, it does wipe the data (Shared Objects and ApplicationDirectory) but it will not wipe it with an app upgrade from the Play store or if you side load the apk.  For example, if you have the app installed and you use dropbox to install a new version on your device via side load, data will be preserved.  If you use an SQL DB, it also gets wiped but only if you store it to the app directory.  If you install to the docs directory, I don't think it gets wiped with USB install.  Can you just have a test function that pre-populates the shared object on app first run?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2014 0
Contributor ,
Jul 03, 2014

Copy link to clipboard

Copied

Thought of another option.  You could publish your apk in flash pro without installing on a device and once compiled have a command line window open and do a quick ADB install.  Would take a few extra seconds but it would achieve your result.

adb install -r foo.apk

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2014 0
Engaged ,
Jul 03, 2014

Copy link to clipboard

Copied

Adding to the discussion. If you open the app drawer when installing your app through Flash, you should see the app disappear for a second and then come back. Based on that visual cue, Im pretty sure Flash actually deletes/uninstalls the app first and then installs the new one.

Adding to mola2alex's comment as an fyi, the "-r" in the install command means: ('-r' means reinstall the app, keeping its data)

That comes directly from calling "adb help" and looking through what it prints out in Terminal. Lastly, if you do decide to use the ADB commands and are on a Mac you need to do "./adb"

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2014 0
Engaged ,
Jul 03, 2014

Copy link to clipboard

Copied

Thanks guys this info is very helpful. So it sounds like installing via Flash Pro is what's doing the data wipe, probably due to delete/uninstall before install, but if I side-load/ad-hoc install I should be able to preserve data, and end users would have no problem.

Now, is there a way to connect an AIR debugger (Flash Pro, or FlashDevelop or FlashBuilder) after I install it on my device via adb or iTunes?

Thanks!

-Aaron

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2014 0