Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alasdairhendry opened this issue Mar 2, 2023 · 2 comments

Comments

@alasdairhendry
Copy link

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:

@arxheji
Copy link

arxheji commented Aug 2, 2023

Did you find a solution for this?

@MiguelQueiroz
Copy link

MiguelQueiroz commented Oct 26, 2023

From what I observe is that Killing the App kills the background service.
In normal conditions, closing the app, or rebooting the phone does not kills the service and the push notification works, even without the "force-start" params. It's like the app needs to start at least once to register the background service.

However the doc says :"If you add force-start: 1 to the data payload the application will be restarted in background even if it was force closed." Looks to be untrue, means force close? killing it/force stop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants