permission
permission copied to clipboard
Grouping Permissions for Android does not work
It looks like from the README that the requested permissions are grouped under specific categories to get full permissions. Specifically the one I am working with is PermissionName.SMS which has 5 subcategories. The android permission I needed to work specifically was SEND_SMS. This failed every time. Upon further inspection in PermissionPlugin.java in the Android folder I found this bit ~
privateString getManifestPermission(String permission) {
String result;
switch (permission) {
case "Calendar":
result = Manifest.permission.READ_CALENDAR;
break;
case "Camera":
result = Manifest.permission.CAMERA;
break;
case "Contacts":
result = Manifest.permission.READ_CONTACTS;
break;
case "Location":
result = Manifest.permission.ACCESS_FINE_LOCATION;
break;
case "Microphone":
result = Manifest.permission.RECORD_AUDIO;
break;
case "Phone":
result = Manifest.permission.CALL_PHONE;
break;
case "Sensors":
result = Manifest.permission.BODY_SENSORS;
break;
case "SMS":
result = Manifest.permission.READ_SMS;
break;
case "Storage":
result = Manifest.permission.READ_EXTERNAL_STORAGE;
break;
default:
result = "ERROR";
break;
}
return result;
}
Simply pulling down this code and changing READ_SMS to SEND_SMS fixed my problem. The issue here is that this code needs updated to support the other functionalities given. Also, as a general opinion since Google is cracking down on all applications requesting SMS permissions it would probably be beneficial to not group them together to allow better developer control. If I get sometime this weekend I will push a fixed version your way if you would like.
Can you give me a demo?
Can you give me a demo?
Sir, I have the same problem. In Android 6.0,Snapdragon 625 Mobile Platform, there is an error that stops running after the location, network, camera, and storage permissions are agreed upon during installation
[+11104 ms] D/AndroidRuntime( 2787): Shutting down VM
[ +34 ms] E/AndroidRuntime( 2787): FATAL EXCEPTION: main
[ ] E/AndroidRuntime( 2787): Process: com.seck.water_app, PID: 2787
[ ] E/AndroidRuntime( 2787): 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 {com.seck.water_app/com.seck.water_app.MainActivity}: java.lang.IllegalArgumentException: Unknown permission: ERROR
[ ] E/AndroidRuntime( 2787): at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
[ ] E/AndroidRuntime( 2787): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
[ ] E/AndroidRuntime( 2787): at android.app.ActivityThread.-wrap16(ActivityThread.java)
[ ] E/AndroidRuntime( 2787): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
[ ] E/AndroidRuntime( 2787): at android.os.Handler.dispatchMessage(Handler.java:102)
[ ] E/AndroidRuntime( 2787): at android.os.Looper.loop(Looper.java:148)
[ ] E/AndroidRuntime( 2787): at android.app.ActivityThread.main(ActivityThread.java:5417)
[ ] E/AndroidRuntime( 2787): at java.lang.reflect.Method.invoke(Native Method)
[ ] E/AndroidRuntime( 2787): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ ] E/AndroidRuntime( 2787): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
[ ] E/AndroidRuntime( 2787): Caused by: java.lang.IllegalArgumentException: Unknown permission: ERROR
[ ] E/AndroidRuntime( 2787): at android.os.Parcel.readException(Parcel.java:1603)
[ ] E/AndroidRuntime( 2787): at android.os.Parcel.readException(Parcel.java:1552)
[ ] E/AndroidRuntime( 2787): at android.content.pm.IPackageManager$Stub$Proxy.shouldShowRequestPermissionRationale(IPackageManager.java:2683)
[ ] E/AndroidRuntime( 2787): at android.app.ApplicationPackageManager.shouldShowRequestPermissionRationale(ApplicationPackageManager.java:522)
[ ] E/AndroidRuntime( 2787): at android.app.Activity.shouldShowRequestPermissionRationale(Activity.java:3861)
[ ] E/AndroidRuntime( 2787): at androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale(ActivityCompat.java:549)
[ ] E/AndroidRuntime( 2787): at com.ly.permission.PermissionPlugin.onRequestPermissionsResult(PermissionPlugin.java:142)
[ ] E/AndroidRuntime( 2787): at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEnginePluginRegistry.java:664)
[ ] E/AndroidRuntime( 2787): at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onRequestPermissionsResult(FlutterEnginePluginRegistry.java:364)
[ ] E/AndroidRuntime( 2787): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:579)
[ ] E/AndroidRuntime( 2787): at io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:601)
[ ] E/AndroidRuntime( 2787): at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6553)
[ ] E/AndroidRuntime( 2787): at android.app.Activity.dispatchActivityResult(Activity.java:6432)
[ ] E/AndroidRuntime( 2787): at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
[ ] E/AndroidRuntime( 2787): ... 9 more
This might help https://www.youtube.com/watch?v=uMvGpBOT0ZY