ionic3 本地通知

ionic cordova plugin add cordova-plugin-local-notification
npm install --save @ionic-native/local-notifications

检测是否有权限

 this.localNotifications.hasPermission().then(data=>{
        if(!data){
          this.localNotifications.requestPermission().then(data=>{
            console.log("data:"+data);
          })
        }
    })

自定义通知栏

  this.localNotifications.schedule({
      id: 1,
      title:result['memberName'],
      text: result['text'],
      sound: "",
      data: { groupId: result['groupId'],groupTitle:result['groupTitle'] },
      vibrate:true,
      wakeup:true,
    });

点击通知栏回调

 this.localNotifications.on('click').subscribe(result=>{
 });

github:https://github.com/katzer/cordova-plugin-local-notifications

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容