Skip to content

[BUG] Permission request is swallowed on app restart on Android #55

Description

@rlnt

Bug Description

After implementing a camera permission request via Grant, I noticed that the first request is swallowed when invoked.

Expected Behavior

I would expect that the rationale dialog shows up when requesting permission.

Actual Behavior

Nothing happens.

Steps to Reproduce

Here is a minimal reproduction project. I am personally using Compose Multiplatform, but it's reproducible in Android-only.
grant-permission-repro.zip

  1. Import the minimal project.
  2. Start the app.
  3. When started, deny the camera permission.
  4. Click the button again to see the rationale.
  5. Cancel the rationale.
  6. Restart the app.
  7. When the app starts, press the button to request permission.
  8. See, nothing happens.
  9. Press again to see the rationale dialog.

Video

Sorry for the washed colors, I forgot to disable HDR. But I am sure you get the idea. This is the restart of the app. The first button click does nothing, but the state is updated. Only the second click brings up the dialog.
https://github.com/user-attachments/assets/93f92360-2fb7-45f4-adb7-1bc85d3f1450

Environment

Grant Version:
2.2.1

Platform:

  • Android
  • iOS

Platform Details:

  • Android API Level: 37
  • iOS Version: /
  • Device/Emulator: Android Emulator

Dependencies:

  • Kotlin: 2.4.0
  • Compose: 2.4.0
  • Koin (if applicable): 4.2.2

Workaround

I thought about checking the new state after the first request and checking that to immediately start a second request, but this is rather ugly.

Checklist

  • I have searched existing issues
  • I am using the latest version of Grant
  • I have enabled GrantLogger and included logs
  • I have provided a minimal code sample
  • I have tested on a real device (if applicable)

Metadata

Metadata

Labels

bugSomething isn't working

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