framework7

Open full view…

Downloading and opening external file

brightnsarko
Sun, 19 Feb 2017 12:49:05 GMT

I really dont know where to begin, if it is bug, an issue or the framework not sure i have this app developed in two different frameworks, JQuery Mobile(old version) and Framework7(new ) the jquery one can download and open if the file doesnt exist on the phone but Framemork7 can download the file alright but can't open the file but in the console log is it print the file was open successfully. anything external f7 cant open it and we cant change framework now becos is abt to production. I would be grateful if somebody on assist me in this. this is the sample code app.downloadOrOpenFile = function(file,url,page) { var filePath = "cdvfile://localhost/persistent/"+'manuals/'+file //var filePath = cordova.file.documentsDirectory+file, type = app.getInBrowserType(), page = page, url = url; console.log(filePath); console.log(file); function downloadAsset() { var fileTransfer = new FileTransfer(); app.loader(); fileTransfer.download( url, filePath, function (entry) { window.plugins.toast.showLongCenter("The download completed successfully"); window.resolveLocalFileSystemURL(filePath,function(entry){ cordova.plugins.fileOpener2.open( entry.toURL(), 'application/pdf', { error : function(e) { console.log('Error status: ' + e.status + ' - Error message: ' + e.message); alert('Error status: ' + e.status + ' - Error message: ' + e.message) }, success : function () { console.log('file opened successfully'); alert('file opened successfully') } } ); }, function(){ window.plugins.toast.showLongCenter("Error occurred whiles opening the files"); }); app.hide_loader(); }, function (error) { app.hide_loader(); window.plugins.toast.showLongCenter("...Error downloading file..."); } ); } //Check for the file. window.resolveLocalFileSystemURL(filePath,function(entry){ console.log('Native URI: ' + entry.toURL()); cordova.plugins.fileOpener2.open( entry.toURL(), 'application/pdf',{ error : function(e) { console.log('Error status: ' + e.status + ' - Error message: ' + e.message); }, success : function () { console.log('file opened successfully'); } } ); }, downloadAsset); }

brightnsarko
Sun, 19 Feb 2017 14:00:13 GMT

i'm or so the same problem with the sample code below. Open the other app when the app does exist or send the user download the app $$('.externalApp').on('click',function(event){ event.preventDefault(); var rslog = "com.dexafrica.rsmobi", playstore = "https://play.google.com/store?hl=en", sApp = startApp.set({ "package":rslog, "flags":["FLAG_ACTIVITY_CLEAR_TOP","FLAG_ACTIVITY_CLEAR_TASK"], "intentstart":"startActivity", }); sApp.check( function(message) { /* success */ sApp.start(function(message) { /* success */ console.log(message); // => OK }, function(error) { /* error */ window.plugins.toast.showLongCenter("Rslog failed to launch or open, please check if rslog is properly installed."); }); }, function(error) { /* error */ cordova.plugins.market.open(rslog, { success: function() { // Your stuff here }, failure: function() { console.log("Application failed to open play store..."); } }) } ); })