cordova-plugin-apns-push/README.md
2023-07-15 20:04:18 +08:00

1.8 KiB
Raw Permalink Blame History

cordova-plugin-apns-push

https://github.com/NeutrinosPlatform/cordova-plugin-apns-push 克隆的。 主要修改:

  1. 调整了 app 在活动/非活动状态的逻辑,在活动状态时是不会弹出提醒的。
  2. 需要在发消息时指定 "content-available": 1这样才能接收到数据。但是在试用 https://github.com/PerfectExamples/Perfect-APNS-Demo 时,并不需要这个参数。还是有很多东西没搞明白。
  3. 如果想在活动状态弹出提醒,需要配合 cordova-plugin-local-notifications 插件。

Register and receive APNS push notifications

Install

cordova plugin add git+https://m.shuto.cn:8681/public/cordova-plugin-apns-push

Usage


    var push = window['APNSPushNotification'].init({
        ios: {
            alert: "true",
            badge: "true",
            sound: "true"
        }
        });


    push.on('registration', (data) => {
        // data.registrationId
        this.sendRegDetails(data.registrationId);
    });

    push.on('notification', (data) => {
        window['cordova'].plugins.notification.local.schedule({
        title: data.title,
        text: data.message,
        sound: data.sound,
        at: new Date().getTime()
        });
    });

    push.on('error', (e) => {
        // e.message
        console.error(e);
    });

Supported Platforms

  • iOS

More about us

Find out more or contact us directly here :- http://www.neutrinos.co/

Facebook :- https://www.facebook.com/Neutrinos.co/
LinkedIn :- https://www.linkedin.com/company/25057297/
Twitter :- https://twitter.com/Neutrinosco
Instagram :- https://www.instagram.com/neutrinos.co/

N|Solid