Skip to content

Android app does not invoke callbacks from background action buttons when app is killed. #222

@alasdairhendry

Description

@alasdairhendry

Bug Report

When the app is killed (i.e. totally shutdown, not idle in the background), tapping on an action button with the 'foreground: false' flag does not invoke the target method until the app is manually opened again. This is not an issue when 'foreground:true' is flagged, nor is it an issue on iOS.

Expected Behaviour

The app should invoke the target method immediately.

Actual Behaviour

The app invokes the target method the next time the application is opened.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  • Kill the app (not backgrounded).
  • Send notification to device with an option for a background action button
  • Click the action button

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

Android 11
Cordova-Android version 9.1.0

(Android) Device Vendor (e.g. Samsung, HTC, Sony...)

Google

Sample Push Payload

{
  "data": {
    "message": {
      "title": "Title",
      "body": "Body"
    },
    "actions": [
      {
        "title": "Yes",
        "callback": "actionGenericQuestionYes",
        "foreground": "true"
      },
      {
        "title": "No",
        "callback": "actionGenericQuestionNo",
        "foreground": "false"
      },
      {
        "title": "Maybe",
        "callback": "actionGenericQuestionMaybe",
        "foreground": "true"
      }
    ],
    "sound": "Default",
    "notId": 12345
  }
}

Notes

I've also tried a combination of:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions