How to use the ionic-native.Push.init function in ionic-native

To help you get started, we’ve selected a few ionic-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thomasgazzoni / ng2-platform / src / push / push.ionic.ts View on Github external
const options: PushOptions = {
            android: {
                senderID: this._platformService.FCMSenderId
            },
            ios: {
                alert: true,
                badge: true,
                sound: false
            },
            windows: {

            }
        };

        this.push = Push.init(options);

        // Reset badge
        this.push.setApplicationIconBadgeNumber(() => { }, () => { }, 0);

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

        this.push.on('notification', (data) => {

            this.showPushNotification({
                title: data.title,
                message: data.message,
                data: data.additionalData,
            });
        });
github Backendless / JS-SDK / examples / messaging-service / push-notification / ionic-2 / src / app / app.component.ts View on Github external
initPushNotification() {
    if (!this.platform.is('cordova')) {
      console.warn("Push notifications not initialized. Cordova is not available - Run in physical device");
      return;
    }

    Backendless.setupDevice({
      uuid: Device.uuid,
      platform: Device.platform,
      version: Device.version
    });

    let push = Push.init({
      android: {
        senderID: "YOUR_SENDER_ID"
      },
      ios: {
        alert: "true",
        badge: false,
        sound: "true"
      },
      windows: {}
    });

    push.on('registration', (data) => {
      Backendless.Messaging.registerDevice(data.registrationId).then(
        function () {
          alert("Registration done");
        },
github iampossible / impossiblepeople / ionic-app / src / app / services / NotificationService.ts View on Github external
register() {
    try {
      this.pushNotification = Push.init({
        ios: { alert: 'true', badge: 'true', sound: 'true' },
        android: { senderID: Environment.SENDERID }
      })
      this.pushNotification.on('notification', (data) => {
        this.events.publish('notifications:receive', data)
      })
      this.pushNotification.on('registration', (data) => {
        this.events.publish('notifications:register', data)
      })
      this.pushNotification.on('error', (err) => {
        console.warn('failed to initialise notifications', err.message)
      })

    } catch (err) {
      console.warn('failed to initialise notifications', err)
    }