207. This value is conceptually equivalent to Android’s API level, but Meta VR OS SDK version numbers are independent of the API level of the Android Open Source Project (AOSP) version upon which Horizon OS is based. This value increases with each release that is not a patch to a previously released version. Version numbers may be skipped.2.1. Although this value can be queried via the Meta VR OS SDK, do not reference it for the purposes described in this guide. This API should only be used for situations where the user-facing version number of Horizon OS is relevant, such as in your app’s telemetry. See API reference documentation for more information.| Package | Setup |
|---|---|
NSDK (native C API) | |
JSDK (Java API) | |
Utility Library |
com.meta.metavr:metavr-os-nsdk:207 com.meta.metavr:metavr-os-jsdk:207 com.meta.metavrx.util:util:1.0.0
uses-metavr-sdk elementuses-metavr-sdk, for inclusion in your application’s AndroidManifest.xml file. Similar to the Android uses-sdk element, including this element in your application increases your application’s stability and compatibility across Horizon OS versions.uses-horizonos-sdk element, so applications that declared it keep working. Use uses-metavr-sdk for new work.uses-metavr-sdk element to your manifestuses-metavr-sdk manifest element lets you control your package’s distribution and Horizon OS behavior related to your package.AndroidManifest.xml file:<manifest> element, add the following XML namespace attribute: xmlns:metavr="http://schemas.meta.com/metavr-sdk".<manifest> element, add the <uses-metavr-sdk> element and specify values for the minSdkVersion and targetSdkVersion attributes.<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:metavr="http://schemas.meta.com/metavr-sdk">
<metavr:uses-metavr-sdk
metavr:minSdkVersion="123"
metavr:targetSdkVersion="456" />
...
minSdkVersion attributeminSdkVersion attribute specifies the minimum Meta VR OS SDK version that your application is compatible with.minSdkVersion is compared to the Meta VR OS SDK version available on the OS. If minSdkVersion is greater than the Meta VR OS SDK version present, installation is blocked. Additionally, the package may be filtered out of Store searches or other user interfaces on devices running a version of Horizon OS with which the app is not compatible.minSdkVersionminSdkVersion, evaluate which Meta VR OS SDK version your application is compatible with, and which Horizon OS versions you intend to support.minSdkVersion requirements?minSdkVersion to the Meta VR OS SDK version used in development, both in your project and on your device. This ensures your application will not run on older Horizon OS versions (which you did not develop on).minSdkVersion to the first Meta VR OS SDK version containing all APIs used directly by your application. This enables targeting a wider range of Horizon OS versions while ensuring your application does not invoke APIs that do not exist on the running OS version.minSdkVersion to the lowest Meta VR OS SDK version you can support, even though older versions lack some APIs your application references. At runtime, invoke only APIs available in the Meta VR OS SDK version reported by the version query APIs. This approach maximizes compatibility with older Horizon OS versions.targetSdkVersion attributetargetSdkVersion attribute specifies the Meta VR OS SDK version your application targets.targetSdkVersion are executed instead.targetSdkVersiontargetSdkVersion, evaluate which Horizon OS behavior version your application prefers and which Meta VR OS SDK version your application was tested against.targetSdkVersion frequently to take advantage of the latest Horizon OS advances. In rare cases, an older targetSdkVersion is preferred, such as when your application depends on legacy Horizon OS behavior that no longer works the same way in more recent SDK versions.int first_sdk_version_with_new_api = ... if get_metavr_os_sdk_version() < first_sdk_version_with_new_api then call_deprecated_api() else call_new_api()
dependencies {
implementation("com.meta.metavrx.util:util:1.0.0")
}
MetaVrOsSdkVersion.isAtOrAbove() method to determine the Horizon OS version on which your app is running.import metavrx.os.MetaVrOsSdkVersion
if (MetaVrOsSdkVersion.isAtOrAbove(207)) {
// execute code that only works on Horizon OS version 207 or later
} else {
// fall back to default behavior if APIs are not available
}