android - Combining native app with worklight project -
I am working on a wrechlight application that requires an IO file. I have used that code separately in an Android project Can someone tell me how can I add both of them in one? Like Idan, Indran said, there is no way to stop its existing native application in the Warklight Hybrid application. However, you can benefit from various environments like Android and iOS, which work outside the box with the Varkalite hybrid application. If you create, you will need to create a plugin for all the environments that you want to support .
Here is a quick example of the file I / O API:
// to load Cordoba // to load the document. AddEventListener ("deviceready", onDeviceReady, incorrect); // Cordoba is ready // Work on Device Ready () {window.requestFileSystem (LocalFileSystem.PERSISTENT, 0, gotFS, unsuccessful); } Found (file system) {fileSystem.root.getFile ("readme.txt", {created, exclusive: incorrect}, gotFileEntry, unsuccessful); } Function FoundFileInterry (file entry) {fileEntry.createWriter (found file, failed); } Function gotFileWriter (author) {author.onwriteend = function (evt) {console.log ("now some sample text"); writer.truncate (11); Writer.onwriteend = function (evt) {console .log ("The content of the file is now 'some sample' '); Writer.seek (4); Author. Write ("separate text"); Author.onwriteend = function (evt) {console.log ("The content of the file is now 'some different text' ');}};}; Writer.write (" some sample text ");} function fail (error) {console .log (error.code);} Here is an example of a file:
// to load the Cordova // function Load () {document.addEventListener ("deviceready", OnDeviceReady, incorrect);} // Cordova is ready / work on each device () (window.requestFileSystem (LocalFileSystem.PERSISTENT, 0, gotFS, failed);} found function File system) {fileSystem.root.getFile ("readme.txt", tap, file found, failed);} even Row gotFileEntry (fileEntry) {fileEntry.file (getFile, unsuccessful);} found function file (file) {readDataUrl (file); readAsText (file);} readDataUrl (file) {var reader = new FileReader (); Reader Onloadend = function (evt) {console.log ("read as data URL"); console.log (evt.target.result);}; reader.readAsDataURL (file);} function read text (file) {var Reader = New FileReader (); Reader.onloadend = function (evt) {console.log ("Read as Text"); Console.log (evt.target.result); }; Reader.readAsText (file); } Function unsuccessful (evt) {console.log (evt.target.error.code); }
Comments
Post a Comment