Skip to main content

Posts

Showing posts from February, 2015

Save Image/File into sdcard in Android using PhoneGap

Mostly we call webservice and pass data as json format and we can easily fetch data for android application but sometimes when you fetching image from server it’s take much time to load and even if no internet,image can’t be load. So, To cache image or to save loading time of image from server in every page load, we can store image into local. It’s very easy to store image into local using PhoneGap. Let’s understand the code: document . addEventListener ( "deviceready" , onDeviceReady , false ) ;   function onDeviceReady ( ) { //request the persistent file system      window . requestFileSystem ( LocalFileSystem . PERSISTENT , 0 , fileSystemSuccess , fileSystemFail ) ; } function fileSystemSuccess ( fileSystem ) {      var directoryEntry = fileSystem . root ; // to get root path to directory      directoryEntry . getDirectory ( "<folder_name>" , { create : true , exclusive : false } , onDirectorySuccess , o