|
本帖最后由 DavidChen 于 2024-5-31 09:40 编辑
首先下载HelloXR的官方代码:
git@github.com:KhronosGroup/OpenXR-SDK-Source.git
可以通过git clone git@github.com:KhronosGroup/OpenXR-SDK-Source.git下载代码(我们的runtime是基于1.0.30这个版本编译的)
helloxr的app代码在路径:OpenXR-SDK-Source/src/tests/hello_xr
因为我们已经适配了Openxr,所以只需要做一个分体式开启应用的适配即可,修改AndroidManifest.xml即可:
1、在application标签下添加
- <meta-data
- android:name="yyss.xrapplication"
- android:value="app" />
复制代码 2、将acitivity标签中的android:resizeableActivity设置成true
3、删除 tools:ignore="NonResizeableActivity"
整体AndroidManifest.xml如下:
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:installLocation="auto"
- android:versionCode="1"
- android:versionName="1.0">
- <!--
- Copyright (c) 2017-2023, The Khronos Group Inc.
- SPDX-License-Identifier: Apache-2.0
- -->
- <!-- Tell the system this app requires OpenGL ES 3.2. -->
- <uses-feature
- android:glEsVersion="0x00030002"
- android:required="true" />
- <!-- Tell the system this app works in either 3dof or 6dof mode -->
- <uses-feature
- android:name="android.hardware.vr.headtracking"
- android:required="false"
- android:version="1" />
- <!-- Recommended for haptic feedback -->
- <uses-permission android:name="android.permission.VIBRATE" />
- <!-- If building externally with the OpenXR loader AAR, this would be merged in automatically. -->
- <uses-permission android:name="org.khronos.openxr.permission.OPENXR" />
- <uses-permission android:name="org.khronos.openxr.permission.OPENXR_SYSTEM" />
- <queries>
- <!-- to talk to the broker -->
- <provider android:authorities="org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" />
- <!-- so client-side code of runtime/layers can talk to their service sides -->
- <intent>
- <action android:name="org.khronos.openxr.OpenXRRuntimeService" />
- </intent>
- <intent>
- <action android:name="org.khronos.openxr.OpenXRApiLayerService" />
- </intent>
- </queries>
- <!-- end of elements normally merged from the OpenXR loader AAR -->
- <application
- android:allowBackup="true"
- android:hasCode="false"
- android:icon="@mipmap/ic_helloxr_launcher"
- android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_helloxr_launcher">
- <meta-data
- android:name="yyss.xrapplication"
- android:value="app" />
- <!-- The activity is the built-in NativeActivity framework class. -->
- <!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
- <!-- Theme.Black.NoTitleBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition. -->
- <activity
- android:name="android.app.NativeActivity"
- android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode|density"
- android:excludeFromRecents="false"
- android:exported="true"
- android:launchMode="singleTask"
- android:resizeableActivity="true"
- android:screenOrientation="landscape"
- android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
- <!-- Tell NativeActivity the name of the .so -->
- <meta-data
- android:name="android.app.lib_name"
- android:value="hello_xr" />
- <!-- This filter lets the apk show up as a launchable icon. -->
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- <category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
复制代码
另外,将OpenXR的runtime apk安装到机器就可以运行了
runtime apk (提取码:2vwj)
|
|