谢谢道森!下面提到的问题已在android中解决.但遗憾的是,当我在ios中构建项目时它不起作用,任何人都可以帮忙吗?
我将使用这个插件来构建一个带有本地通知的android/ios应用程序. https://github.com/katzer/cordova-plugin-local-notifications/wiki
首先,我创建了一个phonegap项目
phonegap create notification
Run Code Online (Sandbox Code Playgroud)
添加插件
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
Run Code Online (Sandbox Code Playgroud)
修改/www/config.xml
<gap:plugin name="de.appplant.cordova.plugin.local-notification" />
Run Code Online (Sandbox Code Playgroud)
我将local-notification.js复制到/ www目录并在index.html中引用它
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<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">Device is Ready</p>
</div>
</div>
<script type="text/javascript" …
Run Code Online (Sandbox Code Playgroud)