Skip to content

[Android] onRequestPermissionsResult prevents registerForActivityResult callback #42403

Description

@LimAlbert

Description

Hello,

I'm currently trying to implement health connect on Android 14 but I've found out that registerForActivityResult is never calling its callback since onRequestPermissionsResult

Is there a reason why

@Override
public void onRequestPermissionsResult(
int requestCode, String[] permissions, int[] grantResults) { mDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

doesn't call super.onRequestPermissionsResult(requestCode, permissions, grantResults); ?

After adding it to onRequestPermissionsResult, everything works as expected.

I've tried creating a patch adding this line and everything works as intended (https://github.com/LimAlbert/react-native-health-connect-android14)

Steps to reproduce

  1. yarn
  2. Launch Android studio
  3. Open project
  4. Open logcat
  5. Filter using "REPRO_PERMISSION"
  6. Run App
  7. Accept All permissions
  8. Witness that HAS CALLED CALLBACK is never logged

React Native Version

0.73.2

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M2 Pro
Memory: 170.23 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.12.1
path: ~/.asdf/installs/nodejs/18.12.1/bin/node
Yarn:
version: 1.22.19
path: ~/.asdf/installs/nodejs/18.12.1/bin/yarn
npm:
version: 8.19.2
path: ~/.asdf/plugins/nodejs/shims/npm
Watchman:
version: 2023.11.06.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /Users/alim/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK: Not Found
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11255304
Xcode:
version: 15.0.1/15A507
path: /usr/bin/xcodebuild
Languages:
Java:
version: javac 17
path: /Users/alim/.asdf/shims/javac
Ruby:
version: 3.2.2
path: /Users/alim/.asdf/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.2
wanted: 0.73.2
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Stacktrace or Logs

2024-01-19 21:43:14.409 8656-8656 REPRO_PERMISSION com.reproonrequestpermissionsresult D CALLING LAUNCH

Reproducer

https://github.com/LimAlbert/reproonrequestpermissionsresult

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions