Search code examples
androidpermissionsandroid-permissionssystem-setting

Settings.System.canWrite always returns false


I use below code for getting system permission...what happening even if permission is allowed; still it's showing..

@Override
    protected void onResume() {
        super.onResume();
        if (Build.VERSION.SDK_INT >= 23 && !Settings.System.canWrite(ChooseSender_Receiver.this)){
            Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS);
            intent.setData(Uri.parse("package:" + ChooseSender_Receiver.this.getPackageName()));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivityForResult(intent, REQUEST_WRITE_SETTINGS);
        }

Note: My problem is even if permission is already allows still it's showing popup..when deny and allows the permission dialog is dismissing.

My device is Moto e2 & Redmi mbls version M

enter image description here


Solution

  • Finally there is no solution for this

    Its based on device hardware issues..i check share it application even it's asking two time permission.