zoukankan      html  css  js  c++  java
  • 【Ionic】---Using Local Notifications In Your Ionic Framework App

    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);
            });
        }
     
    });
  • 相关阅读:
    内存警告
    倒影效果
    设计模式六大原则
    设计模式
    GCD线程
    字符串颜色值转换
    下划线按钮
    电池栏上弹窗
    项目发布相关
    UINib xib加载
  • 原文地址:https://www.cnblogs.com/itguliang/p/4651095.html
Copyright © 2011-2022 走看看