抱歉,我是Cordova应用程序创建的新手。
结果:
C:\LAB\Cordova\notification>cordova plugin ls
[ 'de.appplant.cordova.plugin.local-notification',
'org.apache.cordova.device' ]
此时一切都很好。 我按照github自述文件:https://github.com/katzer/cordova-plugin-local-notifications/blob/master/README.md
* PhoneGap Build 将以下xml添加到config.xml以始终使用此插件的最新版本:
<gap:plugin name="de.appplant.cordova.plugin.local-notification" />*
然后我将它添加到我的config.xml中:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<gap:plugin name="de.appplant.cordova.plugin.local-notification" />
</widget>
然后我添加了index.html
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>PhoneGap</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received" onclick="window.plugin.notification.local.add({ message: 'Great app!' });">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="local-notification.js"></script>
<script type="text/javascript">]
window.plugin.notification.local.add({ message: 'Great app!' });
</script>
</body>
当我启动:Cordova build android
时遇到此错误 BUILD FAILED
C:\ANDROID\android-sdk-windows\sdk\tools\ant\build.xml:653: The following error
occurred while executing this line:
C:\ANDROID\android-sdk-windows\sdk\tools\ant\build.xml:698: null returned: 1
Total time: 10 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\LAB\Cordova\n
otification\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=a
nt-gen
Error: cmd: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\Admin\AppData\Roaming\npm\node_module
s\cordova\src\superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
C:\LAB\Cordova\notification>cordova plugin ls
[ 'de.appplant.cordova.plugin.local-notification',
'org.apache.cordova.device' ]
有人会向我解释如何在工作的基本Cordova应用程序中正确实现插件吗?
谢谢。 [R