diff --git a/Xamarin.Essentials/Platform/Platform.android.cs b/Xamarin.Essentials/Platform/Platform.android.cs index 9a3f06a21..7a1e830de 100644 --- a/Xamarin.Essentials/Platform/Platform.android.cs +++ b/Xamarin.Essentials/Platform/Platform.android.cs @@ -180,8 +180,13 @@ internal static AndroidUri GetShareableFileUri(string filename) false; #endif + static int? sdkInt; + + internal static int SdkInt + => sdkInt ??= (int)Build.VERSION.SdkInt; + internal static bool HasApiLevel(BuildVersionCodes versionCode) => - (int)Build.VERSION.SdkInt >= (int)versionCode; + SdkInt >= (int)versionCode; internal static CameraManager CameraManager => AppContext.GetSystemService(Context.CameraService) as CameraManager;