Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Cannot save files on Android

$
0
0

I'm trying to save a simple text file on Android, but no matter what I cant seem to create a file. Here is where I am at the minute:

var file = Ti.Filesystem.getFile( Ti.Filesystem.applicationDataDirectory, "data.json" );
 
// create new file if on iOS
if (OS_IOS) {
    file.createFile();
}
 
// Always returns false on Android, iOS works perfectly
Ti.API.info("file exists: " + file.exists() );
 
if ( file.exists() && file.writable )
{
    var JSONString = JSON.stringify(dataJSON);
    file.write( JSONString );
    if ( OS_IOS ) file.setRemoteBackup(false);
}
I'm using Ti 3.4.0.GA and and running on Genymotion emulator

Thanks!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>