Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open specific app's permission setting flutter?

I wonder how to open permission setting for specific app in Flutter? I search on internet but no article show me how to do that, just some solutions for android, like this. Open app permission settings

like image 397
One Any Avatar asked Jan 24 '23 12:01

One Any


1 Answers

hi there try this code to ask for permission and open app settings like for location with the help of permission_handler(https://pub.dev/packages/permission_handler) package

Future<void> _request_permission(context,Function fn)async{
    final Permission location_permission=Permission.location;
    bool location_status=false;
    bool ispermanetelydenied= await location_permission.isPermanentlyDenied;
    if(ispermanetelydenied) {
      print("denied");
      await  openAppSettings();
    }else{
      var location_statu = await location_permission.request();
      location_status=location_statu.isGranted;
      print(location_status);
    }
 
  }

Here this function allows you to open the app setting and manage permission in the case user permanently denied the permission

openAppSettings();

thanks

like image 86
Azad Prajapat Avatar answered Feb 01 '23 15:02

Azad Prajapat