diff --git a/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj b/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj index 91b90a1ca..3634e033b 100644 --- a/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj +++ b/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj @@ -8,7 +8,7 @@ Library DeviceTests.Droid XamarinEssentialsDeviceTestsAndroid - v9.0 + v10.0 True Resources\Resource.designer.cs Resource @@ -57,6 +57,10 @@ + + + + diff --git a/DeviceTests/DeviceTests.Android/Properties/AndroidManifest.xml b/DeviceTests/DeviceTests.Android/Properties/AndroidManifest.xml index 9c53b14bb..ffaf3624a 100644 --- a/DeviceTests/DeviceTests.Android/Properties/AndroidManifest.xml +++ b/DeviceTests/DeviceTests.Android/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@  - + diff --git a/DeviceTests/DeviceTests.Android/Resources/layout/Tabbar.axml b/DeviceTests/DeviceTests.Android/Resources/layout/Tabbar.axml index ad1f87d81..bc2faec48 100644 --- a/DeviceTests/DeviceTests.Android/Resources/layout/Tabbar.axml +++ b/DeviceTests/DeviceTests.Android/Resources/layout/Tabbar.axml @@ -1,5 +1,5 @@ - - + diff --git a/Samples/Samples.Android/Resources/layout/Tabbar.axml b/Samples/Samples.Android/Resources/layout/Tabbar.axml index ad1f87d81..bc2faec48 100644 --- a/Samples/Samples.Android/Resources/layout/Tabbar.axml +++ b/Samples/Samples.Android/Resources/layout/Tabbar.axml @@ -1,5 +1,5 @@ -Properties\AndroidManifest.xml Resources Assets - v9.0 + v10.0 true true Xamarin.Android.Net.AndroidClientHandler @@ -58,6 +58,7 @@ + @@ -67,6 +68,10 @@ + + + + diff --git a/Xamarin.Essentials/Browser/Browser.android.cs b/Xamarin.Essentials/Browser/Browser.android.cs index b3e682c9b..1d36cc927 100644 --- a/Xamarin.Essentials/Browser/Browser.android.cs +++ b/Xamarin.Essentials/Browser/Browser.android.cs @@ -1,9 +1,11 @@ using System; using System.Threading.Tasks; - using Android.Content; +#if __ANDROID_29__ +using AndroidX.Browser.CustomTabs; +#else using Android.Support.CustomTabs; - +#endif using AndroidUri = Android.Net.Uri; namespace Xamarin.Essentials diff --git a/Xamarin.Essentials/Permissions/Permissions.android.cs b/Xamarin.Essentials/Permissions/Permissions.android.cs index 92676480e..59fbb843d 100644 --- a/Xamarin.Essentials/Permissions/Permissions.android.cs +++ b/Xamarin.Essentials/Permissions/Permissions.android.cs @@ -5,8 +5,13 @@ using Android; using Android.Content.PM; using Android.OS; +#if __ANDROID_29__ +using AndroidX.Core.App; +using AndroidX.Core.Content; +#else using Android.Support.V4.App; using Android.Support.V4.Content; +#endif namespace Xamarin.Essentials { diff --git a/Xamarin.Essentials/Platform/Platform.android.cs b/Xamarin.Essentials/Platform/Platform.android.cs index 2f6b8dd9d..e0e53fcbe 100644 --- a/Xamarin.Essentials/Platform/Platform.android.cs +++ b/Xamarin.Essentials/Platform/Platform.android.cs @@ -11,7 +11,6 @@ using Android.Net; using Android.Net.Wifi; using Android.OS; -using Android.Support.V4.Content; using AndroidUri = Android.Net.Uri; namespace Xamarin.Essentials diff --git a/Xamarin.Essentials/Types/FileProvider.android.cs b/Xamarin.Essentials/Types/FileProvider.android.cs index ea621e288..90fc0aa46 100644 --- a/Xamarin.Essentials/Types/FileProvider.android.cs +++ b/Xamarin.Essentials/Types/FileProvider.android.cs @@ -4,6 +4,11 @@ using Android.Content; using Android.OS; using AndroidEnvironment = Android.OS.Environment; +#if __ANDROID_29__ +using ContentFileProvider = AndroidX.Core.Content.FileProvider; +#else +using ContentFileProvider = Android.Support.V4.Content.FileProvider; +#endif namespace Xamarin.Essentials { @@ -13,9 +18,9 @@ namespace Xamarin.Essentials Exported = false, GrantUriPermissions = true)] [MetaData( - "android.support.FILE_PROVIDER_PATHS", + "android.support.FILE_PROVIDER_PATHS", // IMPORTANT: This string doesn't change with AndroidX Resource = "@xml/xamarin_essentials_fileprovider_file_paths")] - public class FileProvider : global::Android.Support.V4.Content.FileProvider + public class FileProvider : ContentFileProvider { internal static bool AlwaysFailExternalMediaAccess { get; set; } = false; @@ -89,9 +94,9 @@ internal static bool IsFileInPublicLocation(string filename) #if __ANDROID_29__ Platform.AppContext.GetExternalFilesDir(null).CanonicalPath, #else - #pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete AndroidEnvironment.ExternalStorageDirectory.CanonicalPath, - #pragma warning restore CS0618 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete #endif Platform.AppContext.ExternalCacheDir.CanonicalPath }; diff --git a/Xamarin.Essentials/WebAuthenticator/WebAuthenticator.android.cs b/Xamarin.Essentials/WebAuthenticator/WebAuthenticator.android.cs index b78b97846..1f2f7afdb 100644 --- a/Xamarin.Essentials/WebAuthenticator/WebAuthenticator.android.cs +++ b/Xamarin.Essentials/WebAuthenticator/WebAuthenticator.android.cs @@ -1,7 +1,11 @@ using System; using System.Threading.Tasks; using Android.Content; +#if __ANDROID_29__ +using AndroidX.Browser.CustomTabs; +#else using Android.Support.CustomTabs; +#endif namespace Xamarin.Essentials { diff --git a/Xamarin.Essentials/Xamarin.Essentials.csproj b/Xamarin.Essentials/Xamarin.Essentials.csproj index 9fcc1b348..0c9335ab5 100644 --- a/Xamarin.Essentials/Xamarin.Essentials.csproj +++ b/Xamarin.Essentials/Xamarin.Essentials.csproj @@ -1,6 +1,6 @@  - netstandard1.0;netstandard2.0;Xamarin.iOS10;Xamarin.TVOS10;Xamarin.WatchOS10;MonoAndroid60;MonoAndroid70;MonoAndroid71;MonoAndroid80;MonoAndroid81;MonoAndroid90;MonoAndroid10.0;tizen40; + netstandard1.0;netstandard2.0;Xamarin.iOS10;Xamarin.TVOS10;Xamarin.WatchOS10;MonoAndroid80;MonoAndroid81;MonoAndroid90;MonoAndroid10.0;tizen40; $(TargetFrameworks);uap10.0.16299; Xamarin.Essentials Xamarin.Essentials @@ -76,11 +76,18 @@ + + + + + + +