Skip to content

Instantly share code, notes, and snippets.

@falkolab
Created Mar 17, 2016
Embed
What would you like to do?
How to access to file in storage card `/sdcard/anyfolder/myfile` in Titanium SDK
// need storage permission to be added in manifest
function getFileFromExternalStorage(path) {
if(Ti.Filesystem.isExternalStoragePresent()) {
var file = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, path);
var newPath = file.nativePath.split(Ti.Filesystem.separator + Ti.App.id).join('');
file = Ti.Filesystem.getFile(newPath);
if(file.exists()) return file;
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment