Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //declaration of variables
- static AndroidJavaClass versionInfo;
- int SDK_INT;
- //function
- void Awake()
- {
- AndroidVersion();
- SDK_INT = AndroidVersion();
- if (SDK_INT >= 33)
- {
- }
- else
- {
- if (Permission.HasUserAuthorizedPermission(Permission.ExternalStorageRead))
- {
- Debug.Log("King of Crokinole has access to Gallery");
- }
- else
- {
- Permission.RequestUserPermission(Permission.ExternalStorageRead);
- }
- if (Permission.HasUserAuthorizedPermission(Permission.ExternalStorageWrite))
- {
- Debug.Log("King of Crokinole has access to Camera");
- }
- else
- {
- Permission.RequestUserPermission(Permission.ExternalStorageWrite);
- }
- }
- }
- //statics
- static int AndroidVersion()
- {
- AndroidJavaClass tempJClass = new AndroidJavaClass("android.os.Build$VERSION");
- versionInfo = tempJClass;
- int getSDK = PREVIEW_SDK_INT;
- Debug.Log($"getSDK = {getSDK}");
- return getSDK;
- }
- public static int PREVIEW_SDK_INT
- {
- get
- {
- return versionInfo.GetStatic<int>("SDK_INT");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement