- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 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/
嗨,这是我在这里的第一个问题,所以如果由于某种原因不遵守规则,结果是重复的或其他什么,请友好地告诉我(并不是说我首先会失去任何声誉) 无论如何,关于 Java 提供的此类 StringReader,我
我继承了这段代码,它似乎不是最优的,而且可能不正确,因为它在窗口和文档对象上添加了事件监听器。但是,除黑莓5.0外,它都可以正常工作。有人可以解释一下所有这些设置是否正确,或者是否有任何建议可以使其更
我被要求在第三方网站上执行维护,我可以编辑 JavaScript,但不能编辑后端代码。该站点使用一个插件,可以在 jQuery.ready 调用中设置各种样式和事件。我想停止它而不引起错误。我可以在模
在下面的代码片段中: Get Started! $(document).ready(function() { $('#indexGet
我有一个包含多个 html 文件的 phonegap 应用程序,对于每个 html 文件,我都有 js.file。在每个 js 文件中,我都添加了一个 eventListener,如下所示: func
您好,我正在尝试创建一个书签,它会打开一个网页,在该网页上找到一个下载链接,然后关闭该网页。除非有更好的方法,否则我将打开页面,调用 ready(我认为这是无效的部分),然后搜索下载链接。导入jQue
关于我的问题:Validate dynamically added control 我们是否应该始终在 javascript 上使用 ready 函数? 最佳答案 一个人应该只有在保证这样的操作有效并
以下两种情况给我相同的行为。但是技术上有什么区别? (我把下面的代码放在正文中脚本标签的最后一部分。) $(document).ready(function() { $('.collapse').
我的程序使用共享内存作为数据存储。此数据必须可供任何正在运行的应用程序使用,并且必须快速获取此数据。但是一些应用程序可以运行在不同的 NUMA 节点上,并且它们的数据访问非常昂贵。每个 NUMA 节点
我有一个 控制台 .net 核心中的应用程序。 如何实现 Kubernetes 就绪/活跃度探测? 我的应用程序循环处理rabbitmq 消息,并且不监听任何http 端口。 最佳答案 对于这种情况,
在嵌入式系统上使用ALSA捕获时,我仍然遇到问题。 使用snddevices脚本后,我现在可以从库中打开设备。但是在每次调用大约10秒钟后,应用程序在Input/output error调用上返回错误
我想知道如何在 Facebook 应用程序的 FBJS 中使用 $(document).ready 或类似的东西。我尝试了 $(document).ready 但它不起作用。我也找不到任何相关文件..
我在 $('document').ready 中定义了一个函数。 $('document').ready(function() { function visit(url) { $.ajax
下面是一个简单的测试用例来演示我正在尝试做的事情: Test $(document).ready(function() { $(":target").css('color', 'r
使用 ember cli v0.1.4、ember 1.8.1 和 cordova 3.7,我正在使用初始化程序等待设备准备就绪; var CordovaInitializer = { name:
我正在研究 jQuery 最佳实践并找到了 this文章 by Greg Franko 通常,我会: $("document").ready(function() { // The DOM i
这个问题已经有答案了: What is the scope of variables in JavaScript? (27 个回答) 已关闭 5 年前。 我想在 $(document).ready(x
我成功地使用 gce ingress 使用 GKE 创建了一个集群。但是 Ingress 需要很长时间才能检测到服务是否就绪(我已经设置了 livenessProbe 和 readinessProbe
我不确定我在这里问的问题是否正确,但基本上我是用ajax请求插入html: // data-active_chart if ($("#charts").attr("data-active_chart"
我正在使用 Foundation CSS 框架,它在页脚中加载 jQuery。这不是非典型做法,也是许多人推荐的做法。但是,我需要在页面中编写脚本。使用 document ready 应该可以解决问题
我是一名优秀的程序员,十分优秀!