Skip to content

PushNotification fails in newIntent getting String with ClassCastException #2467

@sebsoftware

Description

@sebsoftware

Bug Report

Handling Push notification in android fails with ClassCastException getting Bundle data

Plugin(s)

PushNotification 7.04

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

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

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

Platform(s)

Android

Current Behavior

com.capacitorjs.plugins.pushnotifications.PushNotificationsPlugin.handleOnNewIntent(PushNotificationsPlugin.java

because bundle consists by not only strings. Getting the value with getString results in a ClassCastException

google.delivered_priority normal
google.sent_time 1768683270784
google.ttl 2419200
google.original_priority normal
google.product_id 123456783
from 877301795336
google.message_id 0:1768683270790766%601d94ab601d94ab
gcm.n.analytics_data Bundle[mParcelledData.dataSize=100]
collapse_key de.example.app

Expected Behavior

Skip non string values, or leave numbers as numbers etc...

Code Reproduction

It fails, if an incoming notification is tapped

Other Technical Details

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions