首页 > 移动平台 > 详细

【Ionic】---Using Local Notifications In Your Ionic Framework App

时间:2015-07-30 10:55:33      阅读:601      评论:0      收藏:0      [点我收藏+]

Using Local Notifications In Your Ionic Framework App

配置好ng-cordova先

<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>

var ionicApp = angular.module("ionic", ["ionic", "ngCordova"]);

然后

cordova plugin add de.appplant.cordova.plugin.local-notification
ionicApp.controller("ExampleController", function($scope, $cordovaLocalNotification) {
 
    $scope.add = function() {
        var alarmTime = new Date();
        alarmTime.setMinutes(alarmTime.getMinutes() + 1);
        $cordovaLocalNotification.add({
            id: "1234",
            date: alarmTime,
            message: "This is a message",
            title: "This is a title",
            autoCancel: true,
            sound: null
        }).then(function () {
            console.log("The notification has been set");
        });
    };
 
    $scope.isScheduled = function() {
        $cordovaLocalNotification.isScheduled("1234").then(function(isScheduled) {
            alert("Notification 1234 Scheduled: " + isScheduled);
        });
    }
 
});

【Ionic】---Using Local Notifications In Your Ionic Framework App

原文:http://www.cnblogs.com/xuan-0107/p/4651095.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!