Alper
Alper

Reputation: 663

Phonegap handling push notification in the background

We're using phonegap push plugin to send interactive push notifications (with buttons). Documentation suggests using "content-available" in the payload for background notifications.

However, even with content-available value set; when user clicks on the push notification button the plugin loads the application and shows the login page. Below is a sample push notification payload.

{
"data" : {
    "title":"Test title", 
    "message":"Test message", 
    "content-available": "1",
    "actions": [{ icon: "", title: "APPROVE", callback: "approve"},
         { icon: "",title: "DENY", callback: "deny"}
        ]
    }
}

Callback functions (approve, deny in the above sample) are fired and push action buttons are handled appropriately.

My question is:

How can the app handle push notification action buttons in the background WITHOUT loading the app and showing the login screen?

Are there any other push plugins that can handle this scenario?

Desired workflow:

  1. The app may or may not be running in the background, the phone may or may not be locked (requiring passcode if locked)
  2. User receives a push notification with approve/deny buttons.
  3. User swipes (down in Android, left in ios) and reveals the buttons.
  4. User clicks on a button
  5. User is NOT prompted for a passcode
  6. App UI is NOT shown
  7. Appropriate callback function is executed (working)

Thanks.

Upvotes: 2

Views: 1796

Answers (1)

Alper
Alper

Reputation: 663

Currently, the plugin does not offer this feature. However, the team is working on it. See the issue in github.

Upvotes: 1

Related Questions