网易云

Ionic实战视频教程(跨平台): https://www.itying.com/goods-1067.html

Flutter实战视频教程(跨平台): https://www.itying.com/goods-1176.html

Phonegap Local Notification

Contents

The Local Notification plugin gives developers the ability to post notifications from their app that show up in the device’s notification area. The API for the local notification plugin follows the W3C Web Notifications specification: https://www.w3.org/TR/notifications/

https://github.com/phonegap/phonegap-plugin-local-notification

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic Phonegap Local Notification插件的安装(Installation)

ionic cordova plugin add phonegap-plugin-local-notification npm install @ionic-native/phonegap-local-notification
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/phonegap-local-notification

Ionic Phonegap Local Notification插件支持的平台(Supported Platforms)

  • Android
  • Browser
  • iOS
  • Windows

Ionic Phonegap Local Notification插件的用法(Usage)

import { PhonegapLocalNotification } from '@ionic-native/phonegap-local-notification/ngx';


constructor(private localNotification: PhonegapLocalNotification) { }

...

this.localNotification.requestPermission().then(
  (permission) => {
    if (permission === 'granted') {

      // Create the notification
      this.localNotification.create('My Title', {
        tag: 'message1',
        body: 'My body',
        icon: 'assets/icon/favicon.ico'
      });

    }
  }
);