简体   繁体   English

科尔多瓦如何添加一个插件正确吗?

[英]Cordova how to add a Plugin right?

I know the questions sounds a bit weired because it looks to be very simple. 我知道问题听起来有些奇怪,因为它看起来非常简单。 In my case I want to add the FCM Plugin ( https://github.com/fechanique/cordova-plugin-fcm ) for Android in my cordova Project. 就我而言,我想在我的cordova项目中添加适用于Android的FCM插件( https://github.com/fechanique/cordova-plugin-fcm )。 As always I have these problem with adding a plugin to my app: 与往常一样,我在向我的应用添加插件时遇到了以下问题:

Do I just have to enter this in my commandline? 我是否只需要在命令行中输入? cordova plugin add cordova-plugin-fcm cordova插件添加cordova-plugin-fcm

Is that all, that a plugin is connected with my App? 仅此而已,一个插件与我的App连接了吗? Dont I have to link my .html file to the .js file from the plugin? 我不必从插件将.html文件链接到.js文件吗? When I do so and go to my plugins folder and copy the .js from the FCM plugin to my www folder and include this to my .html: <script type="text/javascript" src="FCMPlugin.js"></script> . 这样做时,请转到我的plugins文件夹,然后将.js从FCM插件复制到我的www文件夹,并将其包含到我的.html中: <script type="text/javascript" src="FCMPlugin.js"></script> I got and error: 'require is not defined'. 我得到了一个错误:“需求未定义”。 How to do it right a´nd get these plugins wokring? 如何正确解决这些插件的问题?

Go to command line or terminal navigate ti the director of your app and then paste cordova plugin add cordova-plugin-fcm and enter. 转到命令行或终端,导航至应用程序的主管,然后粘贴cordova plugin add cordova-plugin-fcm ,然后cordova plugin add cordova-plugin-fcm并输入。 that's all. 就这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM