Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1184 from xamarin/android-cache-sdkint
Browse files Browse the repository at this point in the history
Cache Android SdkInt at runtime
  • Loading branch information
Redth committed Mar 25, 2020
2 parents ef770bf + 7903e3e commit 34cc39b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Xamarin.Essentials/Platform/Platform.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 34cc39b

Please sign in to comment.