If you want to save something to external storage ( SD Card, USB) … A little thing you might miss.

In your App.xml file, you have uncomment this line in the Android Manifest .

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

In Texas, we have a lot of Oil and Gas Facilities both onshore and offshore.  They leak Green House Gases (GHG). One of my clients provides tools for testing and reducing GHG.  I built a Flex Mobile tablet application for them to take into the field.  It stores data offline since they don’t always have an internet connection.

Challenge was: What do you do if you drop the tablet on the rig and it smashes?  Do you lose all the test data captured on the tablet?  The solution I came up with is to copy the offline data stored on the device onto the SD card.  This would allow them to be able to move the data onto their backup tablet and continue on with the testing using the new device.

This function copies the Local SharedObject, that stores the offline data, onto the SD Card.


public function soToSD():void {

var soOnSD:File = File.documentsDirectory.resolvePath("mGHG.sol");

var soDir:String = File.applicationStorageDirectory.resolvePath("#SharedObjects").nativePath;

var soInAppStorage:File = new File(soDir);

soInAppStorage = soInAppStorage.resolvePath('mGHG2.swf/mGHG.sol');

soInAppStorage.copyTo(soOnSD, true);

var files:Array = File.documentsDirectory.getDirectoryListing();

for (var i:uint = 0; i &lt; files.length; i++) {

trace(files[i].nativePath);

}

}