I'm about to publish an application on Google Play, but my package was rejected because it uses this permission:
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
I included this permission in the AndroidManifest.xml because calling the Email.ComposeAsync function would result in a FeatureNotSupportedException without it.
var message = new EmailMessage
{
Subject = $"Új funkció kérése / Hiba bejelentés ({AppInfo.AppName} {AppInfo.AppVersion})",
Body = "Tisztelt Szoftverfejlesztő!\r\n\r\nKérés / hiba leírása...\r\n\r\nÜdvözlettel\r\n\r\n",
To = [AppInfo.AppEmail],
BodyFormat = EmailBodyFormat.PlainText
};
if (!String.IsNullOrEmpty(AppInfo.DevEmail))
{
message.Bcc = [AppInfo.DevEmail];
}
//await Email.Default.ComposeAsync(message).ConfigureAwait(false);
await Email.ComposeAsync(message).ConfigureAwait(false);
I checked the documentation , and it doesn't specify which permission I should add for this function call to work or why it requires the QUERY_ALL_PACKAGES permission.
These are the exception details:
Microsoft.Maui.ApplicationModel.FeatureNotSupportedException
- Message: Specified method is not supported.
Call stack:
0xFFFFFFFFFFFFFFFFinAndroid.Runtime.RuntimeNativeMethods.monodroid_debugger_unhandled_exceptionC#0x1AinAndroid.Runtime.JNINativeWrapper._unhandled_exceptionat/Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:13,5C#0x1DinAndroid.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_Vat/Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:27,26C#0x17inSystem.Runtime.ExceptionServices.ExceptionDispatchInfo.ThrowC#0x6inSystem.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0C#0xCinAndroid.App.SyncContext.<Post>b__8_0at/Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36,19C#0xEinJava.Lang.Thread.RunnableImplementor.Runat/Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36,6C#0x8inJava.Lang.IRunnableInvoker.n_Runat/Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.Lang.IRunnable.cs:84,4C#0x8inAndroid.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_Vat/Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:26,5C#
The best approach would be to avoid using the QUERY_ALL_PACKAGES permission. Is there a possibility to do this?
according to the docs, you need to add this to the Android manifest