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

checkMicrophonePermissions return no #26

Open
MuhammadEhsanMirzaei opened this issue May 29, 2020 · 1 comment
Open

checkMicrophonePermissions return no #26

MuhammadEhsanMirzaei opened this issue May 29, 2020 · 1 comment

Comments

@MuhammadEhsanMirzaei
Copy link

Hi
final String result = await audioModule.checkMicrophonePermissions();
return no to me
but I'm sure app has permission
Screen Shot 2020-05-29 at 5 41 52 PM

@kamleshwebtech
Copy link

kamleshwebtech commented Mar 11, 2021

I used it, and worked for me:

import 'package:permission_handler/permission_handler.dart';

Future _initSettings() async {
    // final String result = await audioModule.checkMicrophonePermissions();
    var status = await Permission.microphone.status;
    if (!status.isGranted) {
      await Permission.microphone.request().then((value) async {
        if (value.isGranted) {
          // 
          await audioModule.setAudioSettings();
          setState(() {
            canRecord = true;
          });
        } else {
          // SystemNavigator.pop(); // kill the app if permission not granted
        }
      });
    } else {
      // 
      await audioModule.setAudioSettings();
      setState(() {
        canRecord = true;
      });
    }
    return;
  }

I hope, this will also help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants