Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG : app crash on call FlutterContacts.requestPermission(); #85

Open
nastaran-mohammadi opened this issue Nov 21, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@nastaran-mohammadi
Copy link

Hi,
when I call FlutterContacts.requestPermission(); for the first time app crash and error text is:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {my.redant.leaf/my.redant.leaf.MainActivity}: java.lang.NullPointerException

but after first time, it works fine!
tested on both debug and release mode

@nastaran-mohammadi nastaran-mohammadi changed the title app crash on call FlutterContacts.requestPermission(); BUG : app crash on call FlutterContacts.requestPermission(); Nov 21, 2022
@Shahidbangash
Copy link

Shahidbangash commented Dec 14, 2022

Hi, when I call FlutterContacts.requestPermission(); for the first time app crash and error text is: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {my.redant.leaf/my.redant.leaf.MainActivity}: java.lang.NullPointerException

but after first time, it works fine! tested on both debug and release mode

I fixed this issue by adding Permission Handler package and added this code
`

  try {
  
  final PermissionStatus permissionStatus =
  await Permission.contacts.request();

  // isGranted ... Import native

  if (permissionStatus.isGranted) {
    ///  Import Contact Here
  }
} catch (e, stack) {
  log(
    'Error $e',
    stackTrace: stack,
  );
}

`

@joachim-quis joachim-quis added the bug Something isn't working label Feb 9, 2023
@joachim-quis
Copy link
Contributor

Thanks for reporting. I will look soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants