[英]JS does not recognize the plugin of cordova
I use HTML5
and PhoneGap
, 我使用HTML5
和PhoneGap
,
On application I have Local Notification. 在申请时,我有本地通知。
Below is the code: 下面是代码:
The Android implementation for local notification uses a similar interface as the existing iOS localnotification plugin. 本地通知的Android实现使用与现有iOS localnotification插件类似的界面。 The plugin depends on the Android AlarmManager in combination with the Notification Bar . 该插件取决于Android AlarmManager和Notification Bar的组合。
Here my js: 这是我的js:
function appReady() {
alert('Start appReady');
var LN = cordova.require("cordova/plugin/LocalNotification");
alert('LN');
LN.add({
date: new Date(2012, 10, 11, 15, 20, 0, 0),
message: "DeviceReady",
ticker: "This is a sample ticker text",
repeatDaily: false,
id: 1
});
alert('End appReady');
}
the alert 'LN' does not appear. 警报“ LN”不会出现。
here my plugin in config.xml file: 这是我在config.xml文件中的插件:
<cordova>
<access origin="http://127.0.0.1*"/> <!-- allow local pages -->
<access origin=".*"/>
<log level="DEBUG"/>
<preference name="useBrowserHistory" value="true" />
<preference name="exit-on-suspend" value="false" />
<plugins>
...
<plugin name="LocalNotification" value="org.apache.cordova.plugins.LocalNotification"/>
</plugins>
</cordova>
It looks like the JS does not know the plugin , can anyone help? 看起来JS 不知道插件 ,有人可以帮忙吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.