In the official app, when I open a mod_resources (PDF) I receive a dialog for helper apps which can open the filetype. Why would this dialog not appear in our custom build of the app (see screenshot)?
Hi Paul,
are you building your app using Phonegap Build or are you using Cordova CLI? In the latter, please make sure you don't lack any Cordova plugin required by the app.
Kind regards,
Dani
Hi Daniel,
We're building using cordova. Is anything missing from this list in our package.json?
"cordovaPlugins": [ "cordova-plugin-device", "cordova-plugin-globalization", "cordova-plugin-file", "cordova-plugin-inappbrowser", "cordova-plugin-file-transfer", "cordova-plugin-network-information", "cordova-plugin-camera", "cordova-plugin-media-capture", "cordova-plugin-splashscreen", "cordova-plugin-statusbar", "cordova-plugin-whitelist", "ionic-plugin-keyboard", "cordova-plugin-local-notifications-mm", "cordova-plugin-zip" ],
Hi Paul,
in that list you lack some plugins:
net.tunts.webintent
com.phonegap.plugins.pushplugin
cordova-plugin-customurlscheme
ch.ti8m.documenthandler
You can install them running this command:
ionic plugin add https://github.com/Tunts/WebIntent https://github.com/ti8m/DocumentHandler com.phonegap.plugins.PushPlugin cordova-plugin-customurlscheme --variable URL_SCHEME=moodlemobile
Kind regards,
Dani
Hi Dani,
I removed those modules previously as I was having problems building when they were in the list. Unfortunately the issue is still present when building with the config below. Incidentally, I've noticed that a JPEG (file activity) is displayed by the app in the content are of the page (the white area in the image I attached previously).
"cordovaPlugins": [ "net.tunts.webintent", "com.phonegap.plugins.pushplugin", "cordova-plugin-customurlscheme", "ch.ti8m.documenthandler", "cordova-plugin-device", "cordova-plugin-globalization", "cordova-plugin-file", "cordova-plugin-inappbrowser", "cordova-plugin-file-transfer", "cordova-plugin-network-information", "cordova-plugin-camera", "cordova-plugin-media-capture", "cordova-plugin-splashscreen", "cordova-plugin-statusbar", "cordova-plugin-whitelist", "ionic-plugin-keyboard", "cordova-plugin-local-notifications-mm", "cordova-plugin-zip" ],
Hi again,
to open mod_resource PDF files we use the function $mmUtil.openFile. In Android we use the WebIntent plugin (net.tunts.webintent) to open the file in other apps using the dialog you mentioned in the first post.
If for some reason the variable window.plugins doesn't exist, we open the link using:
window.open(path, '_blank');
This window.open is captured by InAppBrowser, resulting in the view in your screenshot. So my guess is that window.plugins variable doesn't exist in your build, maybe the plugin net.tunts.webintent wasn't installed correctly. If you want to debug what's going on I suggest you to look at the $mmUtil.openFile function.
Kind regards,
Dani
Thanks for your help, this is now resolved. I didn't follow your instructions properly, so I hadn't actually downloaded the plugins!
I did get one error from
$ ionic plugin add https://github.com/Tunts/WebIntent https://github.com/ti8m/DocumentHandler com.phonegap.plugins.PushPlugin cordova-plugin-customurlscheme --variable URL_SCHEME=moodlemobile
which was
Fetching plugin "com.phonegap.plugins.PushPlugin" via npm Error: Failed to fetch plugin com.phonegap.plugins.PushPlugin via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: Registry returned 404 for GET on https://registry.npmjs.org/com.phonegap.plugins.PushPlugin
Our latest build plugins and versions
Plugin | Source | Version | Installed | Latest | Platforms |
---|---|---|---|---|---|
ch.ti8m.documenthandler | pgb | 0.2.1 | 0.2.1 | 0.2.1 | android,ios |
com.phonegap.plugins.pushplugin | pgb | 2.5.0 | 2.5.0 | 2.5.0 | android,ios,winphone |
cordova-plugin-camera | npm | * | 2.1.0 | n/a | android,ios,winphone |
cordova-plugin-customurlscheme | npm | * | 4.1.3 | n/a | android,ios,winphone |
cordova-plugin-device | npm | * | 1.1.1 | n/a | android,ios,winphone |
cordova-plugin-file | npm | * | n/a | n/a | android,ios,winphone |
cordova-plugin-file-transfer | npm | * | 1.5.0 | n/a | android,ios,winphone |
cordova-plugin-globalization | npm | * | 1.0.2 | n/a | android,ios,winphone |
cordova-plugin-inappbrowser | npm | * | 1.3.0 | n/a | android,ios,winphone |
cordova-plugin-local-notifications-mm | npm | * | 1.0.1 | n/a | android,ios,winphone |
cordova-plugin-media-capture | npm | * | 1.2.0 | n/a | android,ios,winphone |
cordova-plugin-network-information | npm | * | 1.2.0 | n/a | android,ios,winphone |
cordova-plugin-splashscreen | npm | * | 3.2.0 | n/a | android,ios,winphone |
cordova-plugin-statusbar | npm | * | 2.1.1 | n/a | android,ios,winphone |
cordova-plugin-whitelist | npm | 1.0.0 | 1.0.0 | n/a | android,ios,winphone |
cordova-plugin-zip | npm | * | 3.1.0 | n/a | android,ios,winphone |
ionic-plugin-keyboard | npm | * | 1.0.8 | n/a | android,ios,winphone |
net.tunts.webintent | pgb | 0.2.1 | 0.2.1 | 0.2.1 | android |