Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using plugins with Cordova CLI

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?

like image 660
acimutal Avatar asked Feb 05 '16 06:02

acimutal


People also ask

How do I use Cordova plugins?

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.

Which command is used to install plugin in Cordova?

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.

What is the Cordova CLI used for?

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.


1 Answers

The next line, in the main html file, was missing:

<script type="text/javascript" src="cordova.js"></script>
like image 167
acimutal Avatar answered Oct 02 '22 23:10

acimutal