admin管理员组

文章数量:1434823

I'm trying to request for the permission in Maui Android 14 API 34 .NET version 7.0 always getting access denied Permissions.RequestAsync<Permissions.StorageWrite>(); Also provided necessary permission in AndroidMenifest.xml

    <manifest xmlns:android=";>
    <application android:allowBackup="true" 
             android:icon="@mipmap/appicon" 
             android:supportsRtl="true" 
             android:debuggable="true" 
             android:requestLegacyExternalStorage="true">
    <uses-sdk android:minSdkVersion="21" 
          android:targetSdkVersion="34" /> 
    </application> 
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
        <uses-permission android:name="android.permission.INTERNET" /> 
        <uses-permission android:name="android.permission.RECORD_AUDIO" /> 
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
        <uses-permission android:name="android.permission.READ_EXTERNAL_WRITE" /> 
        <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" /> 
        <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />        </manifest>

Please Help me to get the permissions from the users to Read and Write the audio in Maui Android 14 API 34. I tried with the solution given in the below link .0&tabs=android

I'm trying to request for the permission in Maui Android 14 API 34 .NET version 7.0 always getting access denied Permissions.RequestAsync<Permissions.StorageWrite>(); Also provided necessary permission in AndroidMenifest.xml

    <manifest xmlns:android="http://schemas.android/apk/res/android">
    <application android:allowBackup="true" 
             android:icon="@mipmap/appicon" 
             android:supportsRtl="true" 
             android:debuggable="true" 
             android:requestLegacyExternalStorage="true">
    <uses-sdk android:minSdkVersion="21" 
          android:targetSdkVersion="34" /> 
    </application> 
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
        <uses-permission android:name="android.permission.INTERNET" /> 
        <uses-permission android:name="android.permission.RECORD_AUDIO" /> 
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
        <uses-permission android:name="android.permission.READ_EXTERNAL_WRITE" /> 
        <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" /> 
        <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />        </manifest>

Please Help me to get the permissions from the users to Read and Write the audio in Maui Android 14 API 34. I tried with the solution given in the below link https://learn.microsoft/en-us/dotnet/maui/platform-integration/appmodel/permissions?view=net-maui-8.0&tabs=android

Share Improve this question asked Nov 18, 2024 at 12:40 Hitesh SharmaHitesh Sharma 91 bronze badge 4
  • There is no such thing as "READ_EXTERNAL_WRITE". The permission is "WRITE_EXTERNAL_STORAGE". I also want to ask you a question. Is this what you are trying to use: github/jfversluis/Plugin.Maui.Audio? – H.A.H. Commented Nov 19, 2024 at 5:37
  • If your app targets Android 13 or higher and needs to access media files that other apps have created, you must request one or more of the following granular media permissions instead of the READ_EXTERNAL_STORAGE permission. – liyu Commented Nov 19, 2024 at 6:07
  • @H.A.H yes I'm trying to use Plugin.Maui.Audio and I'm using WRITE_EXTERNAL_STORAGE I wrote that mistakenly and I tried different ways to get Storage write permission but not able to get – Hitesh Sharma Commented Nov 19, 2024 at 12:57
  • @HiteshSharma github/dotnet/maui/issues/14729 read this. Then this: github/dotnet/maui/pull/23909 If you do not get what it says, then come back here. (This is the fella that writes those cool school projects.) – H.A.H. Commented Nov 20, 2024 at 5:25
Add a comment  | 

1 Answer 1

Reset to default 0

If you're running this code in Android 13+, this behavior is expected. StorageRead and StorageWrite have been deprecated in Android 13.

You could refer to the Android official documentation for more details: Granular media permissions.

#if Android
ActivityCompat.RequestPermissions(Platform.CurrentActivity,new string[]{Manifest.Permission.ReadMediaAudio},1);

#endif

本文标签: cMaui Android 14 API 34 Storage Write and Audio Permission not workingStack Overflow