简体   繁体   中英

How to Request manage_external_storage Permission in Xamarin.Android

Please I am looking for a way to request (Manage_External_Storage) Permission in Xamarin.Android because i need this permission in my app after android 11

This permission is about accessing all the files. At first, the permission should be added to the AndroidManifest.xms.And then you can use the following code to request the permission. In addition, you can request the write and read external peimissoin and add them in the Manifest.xml.

 if (!Android.OS.Environment.IsExternalStorageManager)
             {
                 Intent intent = new Intent();
                 intent.SetAction(Android.Provider.Settings.ActionManageAppAllFilesAccessPermission);
                 Android.Net.Uri uri = Android.Net.Uri.FromParts("package", this.PackageName, null);
                 intent.SetData(uri);
                 StartActivity(intent);
             }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM