我正在尝试使用cordova本地通知插件,并且据我所知,直到激活设备就绪功能后,它才起作用。
我已经在StackOverflow上看到了很多问题,并且尝试了以下解决方案,但是当我构建应用程序(使用PhoneGap构建)时,根本没有出现设备就绪功能内的警报。
我将尽量减少代码。
配置:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
version = "1.0.1" >
<name>1.0.1</name>
<description>
hgfdngf
</description>
<author href="https://build.phonegap.com" email="*****">
****
</author>
<content src="index.html" />
<plugin name="org.apache.cordova.device" />
<plugin name="de.appplant.cordova.plugin.local-notification" />
</widget>
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>NRL</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">
<link rel="stylesheet" href="css/main.css"> <!-- Link to main style sheet -->
<script src="js/jquery-1.12.4.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">
<script src="js/jquery.mobile-1.4.5.min.js"></script>-->
<script src="js/javascript.js"></script>
</head>
<body onload="onLoad()">
</body>
</html>
JS:
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
alert("deviceready");
}
最佳答案
您需要像这样引用cordova.js
<script type="text/javascript" src="cordova.js"></script>
替换您的cordova.js路径的路径
关于javascript - 设备就绪功能未触发警报?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43705995/