Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

File persistence after updating app

Hi, my mobile app currently downloads some images to the Application Data Directory. These images are displayed correctly in ImageViews and this works fine when the app is closed and restarted.

However, when I update the app, by doing a rebuild in Titanium, these images are not saved.

The documentation for the desktop API states:

"The data directory is per-user directory for storing application data. It is guaranteed to be writable and stable between releases."

But the mobile API doesn't mention stable storage.

Does anyone know how to make these download files persistent between releases and updated?

Thanks for your help.

— asked May 20th 2010 by Michael Park
  • application
  • data
  • directory
  • file
  • filesystem
  • persistent
  • storage
0 Comments

1 Answer

  • Accepted Answer

    I'm not entirely sure about this, but I used restart my Appcelerator apps by clicking "stop" in Titanium Developer and then hitting "launch". I noticed that by doing that, the simulator would occasionally create a new data directory for my app, which would make it appear that the state had not been persisted.

    Now, when I want to restart an app I exit the app in the simulator, then hit "launch" in Titanium Developer. Doing that, the app always has the same state directory and everything works as described.

    Never seen this problem with an actual on-device install/upgrade either. Think it's just an issue of the simulator generating a random app id for state.

    Out of curiosity, how big are your images and how long does it take to write them to disk? I'm having an issue where writing images to disk takes a VERY long time.

    — answered May 20th 2010 by Alan McConnell
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.