Skip to content

getPermissionStates causes app crash #2504

@zovi-code

Description

@zovi-code

Bug Report

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.

Plugin(s)

"@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/android": "^8.2.0",
"@capacitor/app": "^8.0.1",
"@capacitor/core": "^8.2.0",
"@capacitor/ios": "^8.2.0",
"@capacitor/preferences": "^8.0.1",
"@capacitor/splash-screen": "^8.0.1",
"@capgo/capacitor-app-tracking-transparency": "^8.1.5",

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! 👌

Platform(s)

Android

Current Behavior

This causes crash:

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

Expected Behavior

I expect await FirebaseMessaging.checkPermissions(); not to cause crash

Code Reproduction

https://github.com/ferhadm/capcrash

Additional Context

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.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions