Search This Blog

Saturday 20 February 2016

access phone memory using ionic/cordova

for reading internal memory we need the below cordova plugin

1. cordova-plugin-file
to install
>ionic plugin add cordova-plugin-file

window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){
                                                 //alert("came"+fileSystem.root.toURL()+filename);

                                                 var FileStoredLoc = fileSystem.root.toURL();
}

requestFileSystem on succes returns FileSystem handler. using which you can refer any file/directory in the memory.
https://cordova.apache.org/docs/en/2.4.0/cordova/file/localfilesystem/localfilesystem.html

To find if a file/directory exists in phone memory:

window.resolveLocalFileSystemURL(FileORDirPath,Successhandler,Errorhandler);


No comments:

Post a Comment