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

Grouping Permissions for Android does not work #9

Open
zmisson424 opened this issue Feb 2, 2019 · 3 comments
Open

Grouping Permissions for Android does not work #9

zmisson424 opened this issue Feb 2, 2019 · 3 comments

Comments

@zmisson424
Copy link

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.

@once10301
Copy link
Owner

Can you give me a demo?

@jjvu-xiao
Copy link

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

@myselfuser1
Copy link

This might help https://www.youtube.com/watch?v=uMvGpBOT0ZY

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

4 participants