After stopping myself from asking this question for a week, here I am. I've been trying to resolve the no permission issue of Android. I've developed this app with Flutter and have uploaded it to play store for open testing. But, in release mode, it just never asks for permission. Just never. No message or log in console/logcat.
I've tried using two-three packages of flutter for the same but none worked. It works flawlessly in debug mode, the permission pop-up comes, you allow it and functions work as they should be. In case of release build, the pop-up doesn't come. When you check app's permissions settings, you see that the permission has been auto-denied every time in every device in Android 7.0, 8.0, 10 (not tried in others). Even after allowing the permission from settings, it doesn't work and permission gets denied again.
Code I've used:
With permission package :
var permissionStatus = await Permission.getPermissionsStatus([PermissionName.Storage]); print(permissionStatus.toString()); if (permissionStatus.first.permissionStatus == PermissionStatus.allow) { _saveFile(); } else { var permissions = await Permission.requestPermissions([PermissionName.Storage]); print(permissions.first.permissionStatus.toString()); if (permissions.first.permissionStatus == PermissionStatus.allow) _saveFile(); else Fluttertoast.showToast( msg: "Storage permission required to share!", toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.BOTTOM, timeInSecForIosWeb: 2, backgroundColor: greyColor, textColor: Colors.white, fontSize: 16.0); }
With permission_handler package :
if (await permissionsService.hasStoragePermission()) { print("Saving file"); _saveFile(); } else { final PermissionHandler _permissionHandler = PermissionHandler(); var permission = Platform.isAndroid ? PermissionGroup.storage : PermissionGroup.photos; var result = await _permissionHandler.requestPermissions([permission]); if (result[permission] == PermissionStatus.granted) _saveFile(); else Fluttertoast.showToast( msg: "Storage permission required to share!", toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.BOTTOM, timeInSecForIosWeb: 2, backgroundColor: greyColor, textColor: Colors.white, fontSize: 16.0);
I've also tried using Permission Service.
I found similar question with no answer here - Flutter app wont ask for Storage permission in release mode
My app has already been delayed by Google play Store by taking 16 days to verify, please provide a solution so I can avoid further delay. And No, the flutter clean
doesn't help.
EDIT - Searching for more packages for permission handling on pub.dev, I found permission_plugin which also doesn't work, same issue but it gives an error in logcat.
The error -
2020-10-02 23:54:44.289 16214-16260/? E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception:
MissingPluginException(No implementation found for method check-permissions on channel permissions_plugin)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
<asynchronous suspension>
#1 PermissionsPlugin.checkPermissions (package:permissions_plugin/permissions_plugin.dart:69)
<asynchronous suspension>
#2 _CertificateState._saveImage (package:app_name/screens/app_screen.dart:211)
<asynchronous suspension>
Update : This error comes with other permission packages as well. Now, I believe this is the cause of the problem. I'll share any piece of code required.