I'm using Cordova CLI (v6.0.0) to make an app for Android and I can't load the plugins: cordova-plugin-file and cordova-plugin-dialogs. I know it because the next alerts are shown:
if (!navigator.notification)
alert("Plugin notification not working properly!");
if (!window.requestFileSystem)
alert("Plugin file not working properly!");
Plugins are used after clicking a button (not before ondeviceready event). Plugins have been installed with:
cordova-plugin-file v.1.2.0
cordova plugin add cordova-plugin-file
cordova-plugin-dialogs v4.1.0
cordova plugin add cordova-plugin-dialogs
I've also added the next line in config.xml
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
What I'm doing wrong?
First, you have to pass the plugin-spec command in the command prompt. Then, plugin-spec is saved into the xml and package. json file of an app. After saving the file, we can publish the latest plugin version to npm that our current project supports.
The cordova plugin add command requires you to specify the repository for the plugin code. Please note that when you follow the Web Project Dev workflow and use the CLI, the CLI will take care of adding the plugin code to the appropriate place for each platform.
This guide shows you how to create applications and deploy them to various native mobile platforms using the cordova command-line interface (CLI). This tool allows you to create new projects, build them on different platforms, and run them within an emulator.
The next line, in the main html file, was missing:
<script type="text/javascript" src="cordova.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With