Skip to content

Conversation

@frederikbosch
Copy link

The method getDeliveredNotifications() throws because getString(key) is called on notification.extras but the extras Bundle object contains more than just strings. Booleans cannot be casted to string, see the exception stack trace below.

Key android.progressIndeterminate expected String but value was a java.lang.Boolean.  The default value <null> was returned. 
Attempt to cast generated internal exception:
    java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
        at android.os.BaseBundle.getString(BaseBundle.java:1448)
        at com.capacitorjs.plugins.pushnotifications.PushNotificationsPlugin.getDeliveredNotifications(PushNotificationsPlugin.java:147)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
        at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:837)
        at com.getcapacitor.Bridge.$r8$lambda$FNYM7cvgeBk0k8YXQH7M96Mrf-c(Unknown Source:0)
        at com.getcapacitor.Bridge$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at android.os.Handler.handleCallback(Handler.java:995)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loopOnce(Looper.java:273)
        at android.os.Looper.loop(Looper.java:363)
        at android.os.HandlerThread.run(HandlerThread.java:85)

The method `getDeliveredNotifications()` throws because `getString(key)` is called on `notification.extras` but the `extras` [`Bundle`](https://developer.android.com/reference/android/os/Bundle) object contains more than just strings.
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

Successfully merging this pull request may close these issues.

1 participant