我正在尝试使用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>
索引.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");
}