簡體   English   中英

構建phonegap Notification插件時出現問題

[英]Issue in building phonegap Notification plugin

我是phonegap的新手。 我已經安裝了Cordova Local-Notification插件。 但我收到錯誤“無法讀取未定義的phonegap的屬性'本地'

這是我的代碼


 <!DOCTYPE html> <html> <head> <!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">--> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> <link rel="stylesheet" type="text/css" href="css/index.css"> <title>Hello World</title> </head> <body> <div class="appa"> <h1>Apache Cordovadas</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" src="cordova.js"></script> <script type="text/javascript" src="phonegap.js"></script> <script type="text/javascript" src="../plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://localhost:8080/target/target-script-min.js#anonymous"></script> <!-- <script type="text/javascript" src="js/index.js"></script>--> <script type="text/javascript" charset="utf-8"> // Call onDeviceReady when PhoneGap is loaded. // // At this point, the document has loaded but phonegap-1.0.0.js has not. // When PhoneGap is loaded and talking with the native device, // it will call the event `deviceready`. // // A $( document ).ready() block. $( document ).ready(function() { console.log( "ready!" ); }); document.addEventListener('deviceready', function () { alert("start"); // Schedule notification for tomorrow to remember about the meeting cordova.plugins.notification.local.schedule({ id: 10, title: "Meeting in 15 minutes!", text: "Jour fixe Produktionsbesprechung", at: tomorrow_at_8_45_am, data: { meetingId:"#123FG8" } }); // Join BBM Meeting when user has clicked on the notification cordova.plugins.notification.local.on("click", function (notification) { if (notification.id == 10) { joinMeeting(notification.data.meetingId); } }); // Notification has reached its trigger time (Tomorrow at 8:45 AM) cordova.plugins.notification.local.on("trigger", function (notification) { if (notification.id != 10) return; // After 10 minutes update notification's title setTimeout(function () { cordova.plugins.notification.local.update({ id: 10, title: "Meeting in 5 minutes!" }); }, 600000); }); alert("start"); } , false); </script> </body> </html> 

請幫我解決這個問題。

提前致謝。

嘗試在您的實際手機或仿真上運行它。 許多插件在瀏覽器上進行測試時無法完全正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM