"Advanced" notification options?


#1

Hello, I am trying to get my push notifications to work using the native push plugin (phonegap). Right now I somewhat have it working. I can:

  • Show notifications while I am inside my app using an alert
  • Show notification on my start screen but only when it is off

Right now I am missing the following:

  • Notification showing while I am using other apps, for example Google Chrome app
  • Notification triggering the screen of my device, when a notification is send I want the screen to turn on, I know this can be done because I have other apps (like WhatsApp) that do this all the time but this is not happening with the Push plugin.

This is my code (straight from the docs):

this.checkPermission();

      const options: PushOptions = {
        android: {
            senderID: '123456'
        },
        ios: {
            alert: 'true',
            badge: false,
            sound: 'true'
        },
        windows: {}
    };

      const pushObject: PushObject = this.push.init(options);

      pushObject.on('notification').subscribe((notification: any) => alert(notification.message));
      
      pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
      
      pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));



  checkPermission(){
    this.push.hasPermission()
    .then((res: any) => {
  
      if (res.isEnabled) {
        console.log('We have permission to send push notifications');
        this.createChannel();
      } else {
        console.log('We do not have permission to send push notifications');
      }
  
    });
  }

  createChannel(){
    this.push.createChannel({
      id: "testchannel1",
      description: "My first test channel",
      // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
      importance: 3
     }).then(() => console.log('Channel created'));
  }

Can, what I want, be done? Do I need to configure something to get this done?

Thanks in advance.