I want to make an Android application that runs on Oculus Quest 2, the App needs to get the key event and headset event. So I want to compile OpenXR SDK to .so file so that my Android app can use it. Is that right?
Thank you for your reply.
My Jni Project code is like this:
std::shared_ptr<Options> options = std::make_shared<Options>();
if (!UpdateOptionsFromSystemProperties(*options)) {
return 1;
}
std::shared_ptr<PlatformData> data = std::make_shared<PlatformData>();
data->applicationVM = context.Vm;
data->applicationActivity = context.ActivityObject;
bool requestRestart = false;
bool exitRenderLoop = false;
// Create platform-specific implementation.
std::shared_ptr<IPlatformPlugin> platformPlugin = CreatePlatformPlugin(options, data);
// Create graphics API implementation.
std::shared_ptr<IGraphicsPlugin> graphicsPlugin = CreateGraphicsPlugin(options, platformPlugin);
// Initialize the OpenXR program.
std::shared_ptr<IOpenXrProgram> program = CreateOpenXrProgram(options, platformPlugin, graphicsPlugin);
// Initialize the loader for this platform
PFN_xrInitializeLoaderKHR initializeLoader = nullptr;
if (XR_SUCCEEDED(
xrGetInstanceProcAddr(XR_NULL_HANDLE, "xrInitializeLoaderKHR", (PFN_xrVoidFunction*)(&initializeLoader)))) {
XrLoaderInitInfoAndroidKHR loaderInitInfoAndroid = {XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR};
loaderInitInfoAndroid.applicationVM = context.Vm;
loaderInitInfoAndroid.applicationContext = context.ActivityObject;
initializeLoader((const XrLoaderInitInfoBaseHeaderKHR*)&loaderInitInfoAndroid);
}
LOGI("Create instance");
program->CreateInstance();
when run to CreateInstance()
void CreateInstance() override {
LogLayersAndExtensions();
CreateInstanceInternal();
LogInstanceInfo();
}
when run in the LogLayersAndExtensions() Func, it shows the error like
this