-- 第七课:整合本地通知与社交分享
本地通知Local Notification
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { HomePage } from '../pages/home/home';
import { LocalNotifications } from 'ionic-native';
@Component({
template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
rootPage = HomePage;
constructor(platform: Platform) {
platform.ready().then(() => {
if(platform.is('cordova')){
LocalNotifications.isScheduled(1).then( (scheduled) => {
if(!scheduled){
let firstNotificationTime = new Date();
firstNotificationTime.setHours(firstNotificationTime.getHours()+24);
LocalNotifications.schedule({
id: 1,
title: 'Snapaday',
text: 'Have you taken your snap today?',
at: firstNotificationTime,
every: 'day'
});
}
});
}
});
}
}社交分享
总结
Last updated
