【问题标题】:Issue in building phonegap Notification plugin构建 phonegap 通知插件的问题
【发布时间】:2016-06-09 17:46:39
【问题描述】:

我是 phonegap 的新手。我已经安装了 Cordova 本地通知插件。 但我收到错误“无法读取未定义 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>

请帮助我摆脱过去 3 天的问题。

提前致谢。

【问题讨论】:

  • 我们可以看看你的config.xml吗?

标签: android ios cordova phonegap-plugins


【解决方案1】:

尝试在您的实际手机或模拟器上运行它。 在浏览器上进行测试时,许多插件无法完全工作。

【讨论】:

  • 我想知道我使用的语法是否正确
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-16
相关资源
最近更新 更多