public void OnPreprocessBuild(BuildReport report)

        {
            if (!PXR_BuildTools.LoaderPresentInSettingsForBuildTarget(report.summary.platformGroup))
            {
                return;
            }
            if (report.summary.platformGroup == BuildTargetGroup.Android)
            {
                GraphicsDeviceType firstGfxType = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget)[0];
                if (firstGfxType != GraphicsDeviceType.OpenGLES3 && firstGfxType != GraphicsDeviceType.Vulkan && firstGfxType != GraphicsDeviceType.OpenGLES2)
                {
                    throw new BuildFailedException("OpenGLES2, OpenGLES3, and Vulkan are currently the only graphics APIs compatible with the PicoVR XR Plugin on mobile platforms.");
                }
                if (PXR_BuildTools.GetSettings().stereoRenderingModeAndroid == PXR_Settings.StereoRenderingModeAndroid.Multiview && firstGfxType == GraphicsDeviceType.OpenGLES2)
                {
                    PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES3 });
                }
                if (PlayerSettings.Android.minSdkVersion < AndroidSdkVersions.AndroidApiLevel26)
                {
                    throw new BuildFailedException("Minimum API must be set to 26 or higher for Pico XR Plugin.");
                }
                PlayerSettings.Android.forceSDCardPermission = true;
            }
        }
        public void OnPostGenerateGradleAndroidProject(string path)
        {
            if (!PXR_BuildTools.LoaderPresentInSettingsForBuildTarget(BuildTargetGroup.Android))
            {
                return;
            }

            var manifestPath = path + androidManifestPath;
            var manifestDoc  = new XmlDocument();

            manifestDoc.Load(manifestPath);
            var sdkVersion = (int)PlayerSettings.Android.minSdkVersion;
            var nodePath   = "/manifest/application";

            UpdateOrCreateAttributeInTag(manifestDoc, "/manifest", "application", "requestLegacyExternalStorage", "true");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "pvr.app.type", "value", "vr");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "pvr.sdk.version", "value", "XR Platform_1.2.3.5");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "enable_cpt", "value", PXR_ProjectSetting.GetProjectConfig().useContentProtect ? "1" : "0");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "enable_entitlementcheck", "value", PXR_PlatformSetting.Instance.startTimeEntitlementCheck ? "1" : "0");
            CreateNameValueElementsInTag(manifestDoc, "/manifest", "uses-permission", "name", "android.permission.WRITE_SETTINGS");
            CreateNameValueElementsInTag(manifestDoc, "/manifest", "uses-permission", "name", "android.permission.READ_EXTERNAL_STORAGE");
            CreateNameValueElementsInTag(manifestDoc, "/manifest", "uses-permission", "name", "android.permission.WRITE_EXTERNAL_STORAGE");

            nodePath = "/manifest";
            manifestDoc.Save(manifestPath);
        }