Search code examples
cordovaibm-mobilefirsthybrid-mobile-app

how to load and store file in application directory?


I am new to ibm mobilefirst development.

I can able to access the file from the resource folder in iOS. i.e., i can able to access .pdf or .html file from the resource folder.

Same way how i can do that in MobileFirst Hybrid application.

I tried the following approach.

  1. Tried to load window.requestFileSystem() and get file using window.resolveLocalFileSystemURI command, it is call the success function but not creating any file.
  2. I tried cordova.file.applicationDirectory command in preview it showing exception "unknown application directory" error.
  3. I do not know how to use file transfer cordova plugin in mobilefirst application.

Can any one guide me to solve the issue.


Solution

  • I tried cordova.file.applicationDirectory command in preview it showing exception "unknown application directory" error.

    The Cordova runtime is not available during preview.

    I do not know how to use file transfer cordova plugin in mobilefirst application.

    Not related to MobileFirst. Follow the Cordova API documentation


    Instead you can look at using IBM JSONStore: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/data/jsonstore/