I am working with mobilefirst/worklight application which uses cordova as platform. My previous application was on mobile first 6.1 which uses cordova version 3.1. Now I am upgrading my application to mobilefirst 7.1(Renamed from worklight) which uses cordova version 3.6.
For file system access I am using
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys){
var path = fileSys.root.fullPath;
//Output : file://storage/emulated/0 <-- Cordova 3.1 For Android
//Output : / <-- Cordova 3.6 For Android
});
As cordova changed the structure after version 3.3, I changed fullPath to toURL();
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys){
var path = fileSys.root.toURL();
//Output : file://data/0/com.MyApp/files/files <-- Cordova 3.6 For Android
});
Problem here is it is giving me data path of an application. I am storing data which should be accessible from outside like earlier was -file://storage/emulated/0.
Is there any methos in filesystem which returns me a path which accessible from other application? It should work on ios also.
I found the solution over here : https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/
I can use cordova.file.externalRootDirectory instead of fileSys.root.toURL().