码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2015-07-30 10:58:43      阅读:249      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!