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

bug: Android getDeliveredNotifications are missing the data part #763

Open
5 of 17 tasks
khamaileon opened this issue Nov 25, 2024 · 3 comments
Open
5 of 17 tasks

bug: Android getDeliveredNotifications are missing the data part #763

khamaileon opened this issue Nov 25, 2024 · 3 comments
Labels

Comments

@khamaileon
Copy link

khamaileon commented Nov 25, 2024

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Functions
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

6.2.0

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

I send notifications to iOS and Android, always including data (in this specific case: path and trip_id). When I call getDeliveredNotifications, I receive these two pieces of info in the iOS response, but not in the Android response.

iOS:

[
  {
    "id": "765AD00C-A290-4BEA-A217-3B6E6F37AFD3",
    "title": "Paul Smith",
    "subtitle": "",
    "data": {
      "fcm_options": { "image": "https://domain.app/images/icon.svg" },
      "aps": {
        "alert": { "body": "b", "title": "Paul Smith" },
        "mutable-content": 1
      },
      "google.c.fid": "cE5UuzmK1k52uIElXi9HL3",
      "google.c.a.e": "1",
      "google.c.sender.id": "272527473304",
      "path": "/Awe0EyW/messages/dc480249-38e9-47c2-9f8c-2b5205311263",
      "gcm.message_id": "1732535077617442",
      "trip_id": "Awe0EyW"
    },
    "body": "b"
  },
  {
    "id": "D6C4D5CB-1D22-4976-B8BA-C18E06AA2DD4",
    "title": "Paul Smith",
    "subtitle": "",
    "data": {
      "fcm_options": { "image": "https://domain.app/images/icon.svg" },
      "google.c.fid": "cE5UuzmK1k52uIElXi9HL3",
      "aps": {
        "alert": { "body": "a", "title": "Paul Smith" },
        "mutable-content": 1
      },
      "google.c.a.e": "1",
      "gcm.message_id": "1732535076483747",
      "google.c.sender.id": "272527473304",
      "path": "/Awe0EyW/messages/d6fb828f-ea82-4fe5-8ce0-953363006452",
      "trip_id": "Awe0EyW"
    },
    "body": "a"
  }
]

Android:

[
  {
    "id": "2147483647",
    "tag": "ranker_group",
    "data": {
      "android.reduced.images": true,
      "android.appInfo": "ApplicationInfo{b50504a app.domain}"
    }
  },
  {
    "id": "0",
    "tag": "FCM-Notification:3557634",
    "title": "Paul Smith",
    "body": "a",
    "data": {
      "android.title": "Paul Smith",
      "android.reduced.images": true,
      "android.template": "android.app.Notification$BigTextStyle",
      "android.showChronometer": false,
      "android.text": "a",
      "android.progress": 0,
      "androidx.core.app.extra.COMPAT_TEMPLATE": "androidx.core.app.NotificationCompat$BigTextStyle",
      "android.progressMax": 0,
      "android.appInfo": "ApplicationInfo{ce4ebbb app.domain}",
      "android.showWhen": true,
      "android.bigText": "a",
      "android.progressIndeterminate": false
    }
  },
  {
    "id": "0",
    "tag": "FCM-Notification:3558672",
    "title": "Paul Smith",
    "body": "c",
    "data": {
      "android.title": "Paul Smith",
      "android.reduced.images": true,
      "android.template": "android.app.Notification$BigTextStyle",
      "android.showChronometer": false,
      "android.text": "c",
      "android.progress": 0,
      "androidx.core.app.extra.COMPAT_TEMPLATE": "androidx.core.app.NotificationCompat$BigTextStyle",
      "android.progressMax": 0,
      "android.appInfo": "ApplicationInfo{aed88d8 app.domain}",
      "android.showWhen": true,
      "android.bigText": "c",
      "android.progressIndeterminate": false
    }
  },
  {
    "id": "0",
    "tag": "FCM-Notification:3558114",
    "title": "Paul Smith",
    "body": "b",
    "data": {
      "android.title": "Paul Smith",
      "android.reduced.images": true,
      "android.template": "android.app.Notification$BigTextStyle",
      "android.showChronometer": false,
      "android.text": "b",
      "android.progress": 0,
      "androidx.core.app.extra.COMPAT_TEMPLATE": "androidx.core.app.NotificationCompat$BigTextStyle",
      "android.progressMax": 0,
      "android.appInfo": "ApplicationInfo{5e54431 app.domain}",
      "android.showWhen": true,
      "android.bigText": "b",
      "android.progressIndeterminate": false
    }
  }
]

Expected behavior

Data should be in the Android response too.

Reproduction

https://github.com/capawesome-team/.capacitor-app

Steps to reproduce

Sorry, it's complicated to reproduce a complete test environment with a notification send.

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

Installed Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.
@khamaileon khamaileon added bug/fix Something isn't working needs: triage labels Nov 25, 2024
@robingenz
Copy link
Member

Thank you for your request. I'm not sure if this is supported on Android. Would you be willing to debug this yourself?

You just need to place a breakpoint in this line via Android Studio:

@khamaileon
Copy link
Author

Thank you for your support @robingenz

I set a breakpoint, but I'm not sure what I should look for. When I run the process, nothing stops.

Screenshot 2024-11-25 at 16 18 34

@robingenz
Copy link
Member

robingenz commented Nov 25, 2024

Please take a look at this guide on how to debug an Android app.

Edit: You need to check that notifications.extras has the values you are looking for. If notifications.extras is empty, then it'sn ot supported on Android via this method.

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

No branches or pull requests

2 participants