phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

on('notification') is not called on iOS when app launched from app icon #2744

Open sertal70 opened 5 years ago

sertal70 commented 5 years ago

Expected Behaviour

Scenario:

  1. App is not running or in background, it has been killed.
  2. A notification is sent to the app from a backend service (AWS SNS in my case)
  3. Phone OS shows the notification in the notification center
  4. The user tap on the app icon to launch it

I'm expecting that: after app and plugin initialisation, on('notification') is called so that the app can process the notification data.

Actual Behaviour

Android: after app and plugin intialisation on('notification') is actually called iOS: after app and plugin intialisation on('notification') is not called

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android: 7.0 iOS: 12.2

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Honor 8

Cordova CLI version and cordova platform version

cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
Cordova Platforms     : android 6.4.0, ios 4.5.5

Plugin version

2.2.3

Sample Push Data Payload

{
  "default": "this is a notification message text",
  "APNS_SANDBOX": {
      "aps": {
          "alert": {
              "title": "test title",
              "body": "this is a notification message text"
          },
          "sound": "default",
          "content-available": 1
      }
  },
  "GCM": {
      "data": {
          "body": "this is a notification message text",
          "sound": "default",
          "content-available": "1"
      }
  }
}

Sample Code that illustrates the problem

Logs taken while reproducing problem

henkkelder commented 5 years ago

I see the same behaviour. Searching for a solution.

digaus commented 5 years ago

Yes same issue here...

TruffeCendree commented 5 years ago

I experience the same issue (version 2.2.3 on iOS 9.3.5)

digaus commented 5 years ago

I switched to capacitor because it is much easier to do custom implementations and the push plugin is maintained by ionic

naveedahmed1 commented 5 years ago

@digaus have you tried Action Buttons with Capacitor Push plugin?