final status =
await Permission.phone.request();
if (status ==
PermissionStatus.denied) {
Fluttertoast.cancel();
Fluttertoast.showToast(
msg:
'Please enable permission to access phone call',
toastLength: Toast.LENGTH_LONG);
}
if (status ==
PermissionStatus
.permanentlyDenied) {
Fluttertoast.cancel();
openAppSettings();
Fluttertoast.showToast(
msg:
'Phone call permissions is permanently denied, we cannot request permissions.',
toastLength: Toast.LENGTH_LONG);
}
if (status ==
PermissionStatus.granted) {
print('Successfull)
}D/permissions_handler(17117): No permissions found in manifest for: []8 D/ViewRootImplToast: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false I/InputTransport(17117): Create ARC handle: 0x7a9894d140
CodePudding user response:
Add this code in AndroidManifest.xml
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-feature android:name="android.hardware.telephony" android:required="false" />