Sending background notifications with Ionic Push


#1

This reference seems to indicate that it’s possible to send “silent pushes” that wake up your application so it can “do some sort of processing in the background”.

I send a push notification to the https://api.ionic.io/push/notifications endpoint with the following JSON

{
  "tokens":["my_token"],
  "profile":"my_push_profile",
  "notification": {
    "payload": {
      "foo": "bar"
    },
    "ios": {
      "content_available": 1
    }
  }
}

However, this is treated exactly the same as a normal notification received in the background. I get a notification and I have to click on it before the app actually fires the notification event.

Is this behaviour expected? Is there no way to get the push notification to trigger functionality without having to click on it or have the app in the foreground?

The app is running on an android device. If there’s any other information you need, please let me know.


#2

Any solution? I have the same problem.


#3

No. I never managed to figure out away around this. I had to refactor the functionality in the app in the end.


#4

@NatnaelOsorio For Android "content-available": "1" should work (at least for me, I do nothing else in special):

{
    "registration_ids": ["my device id"],
    "data": {
        "title": "Test Push",
        "message": "Push number 1",
        "info": "super secret info",
        "content-available": "1"
    }
}

See that it is inside data.

For iOS I’m not sure though.

More info: