Skip to content

[Bug]: getPermissionStates causes app crash #8399

@zovi-code

Description

@zovi-code

Capacitor Version

Latest Dependencies:

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

Installed Dependencies:

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

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

Other API Details

npm --version: 10.9.2
node --version: v23.11.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

Production problem

I've released the app on the Play Store month ago and it has ~150 downloads and ~80 uninstall events. Reason for every uninstall event is the application crash that happens due to crash from the attached image. I got two reviews with ratings 1 that reported crash.

JS code

 try {
    const permStatus = await FirebaseMessaging.checkPermissions();
    // Logic for storing `permStatus.receive` in react state...
  } catch {}
Image

Expected Behavior

I'd expect it not to crash 😅

Project Reproduction

Capcrash repository

Additional Information

This happens on some Android devices and on other it works. Crash rate is ~50%.
From Crashlytics, the most recent problematic devices are: Galaxy A15 (Android 16), Galaxy S25+ (Android 16), Galaxy A22 5G (Android 13).

I used @capacitor/push-notifications and this crash was happening. After that I completely refactored my code to use @capacitor-firebase/messaging and exact same thing is happening.

I wrote to support and Robin Genz responded me with this:

This is a bug in Capacitor Core/Android. Please install the latest Capacitor Core and Android version and check if it’s still an issue there. If it’s still an issue, please create a bug report in https://github.com/ionic-team/capacitor.

I have following packages installed as well:

"@capacitor-community/safe-area": "^8.0.1",
"@capacitor-firebase/authentication": "^8.1.0",
"@capacitor-firebase/crashlytics": "^8.1.0",
"@capacitor-firebase/messaging": "^8.1.0",
"@capacitor/app": "^8.0.1",
"@capacitor/preferences": "^8.0.1",
"@capacitor/splash-screen": "^8.0.1",
"@capgo/capacitor-app-tracking-transparency": "^8.1.5",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions