Check if the device is Oculus Quest 1 or Quest 2

How do I detect which headset (android) the application is running on?

I am using XR plugin with Oculus XR. Is there a way to detect which device (Oculus Quest 1 or Oculus Quest 2) the app is running on?

if (isQuest1 == true) {
           //Quest 1 code
       } else {
           Quest 2 code
       }

Hi,

Currently, there is no public API available to detect App is running on Quest 1 or 2 in Oculus XR Plugin.
Could you please share the use cases for it? So we could evaluate to add this support in future Oculus XR plugin release. And maybe there are some alternative available now that I could suggest.

If you also have Oculus Integration Asset install in your project, you could use API below:
OVRPlugin.GetSystemHeadsetType()

Thanks

Hi the actual case for this is due to the eye resolution scale property. Oculus Quest 2 supports higher eye resolution scale whereas Oculus Quest 1 supports not as strong as Oculus Quest 2. So it is very important that when I make a build, the application selects the resolution value depending on the Quest device.

eye resolution scale?

…AFAIK the Quest and Quest 2 do that stuff internally and automatically, there’s no need to worry about it.

Yeah but incase of my application, I set them manually as per scene requirements. So it is very much necessary for me to have this feature of checking which device it is.

Do you just want to change the Render Pipeline Resolution depending on hardware?

if you’re using OVRPlugin, check OVRPlugin.GetSystemHeadsetType() A quest 2 should show up as “Miramar”, I believe.

EDIT: A.K.A Listen to what the unity Rep said lol

Ah yes just saw it. It was not there before :slight_smile:

It is available in Oculus XR plugin since 1.10.0.

https://docs.unity3d.com/Packages/com.unity.xr.oculus@3.0/api/Unity.XR.Oculus.SystemHeadset.html

using Unity.XR.Oculus;

...

var headsetType = Utils.GetSystemHeadsetType();
Debug.Log("System headset type: " + headsetType);
2 Likes

Does anyone know how to detect a Quest Pro? It’s not in that list of enums.

Update the SDK:
https://developer.oculus.com/downloads/unity/
8787655--1193707--upload_2023-2-7_15-27-24.png

2 Likes

Just saw this, thought it covered the bases…
https://stackoverflow.com/questions/66588300/detect-oculus-quest-1-2-headsets-in-unity-with-xr-interaction-toolkit

You can simply get the device name using android :stuck_out_tongue:

Works like a charm


A little hint, if you are using a Quest Pro and the method GetSystemHeadsetType() is still returning “Quest_2” instead of “Meta_Quest_Pro”, be sure to check Quest Pro as a Target Device in your Project Settings → XR Plug-in Management->Oculus.

not any more, for whatever insane reason my quest 2 now calls itself “Standalone HMD”. Great. I’m using SystemInfo.deviceModel, which tells me it’s Oculus Quest… mmm, thanks.

I think I can’t use GetSystemHeadsetType() because I’m not using the OVR plugin, unless I’m getting very confused somewhere…

Did you find a work around?

If you dont want to depend on the oculus plugin you can also use AndroidJavaClass to access the android.os.Build constants, which lets you get the internal codename for the headset:

public enum HeadsetType { Quest2, Quest3 }

var build = new AndroidJavaClass("android.os.Build");
var device = build.GetStatic<string>("DEVICE");
var headsetType = device.Contains("eureka") ? HeadsetType.Quest3 : HeadsetType.Quest2;

If I remember correctly, Quest 2 devices should contain “miramar” in the same constant so that could be used to differentiate between Quest 1 and Quest 2 as well.

1 Like
using UnityEngine;
using System.Collections.Generic;

public class QuestHeadsetDetector: MonoBehaviour
{
    public TextMeshProUGUI textDeviceName;
    public TextMeshProUGUI textHeadset;

    public enum HeadsetType { Quest1, Quest2, Quest3 }

    private void Start()
    {
        Dictionary<string, HeadsetType> headsetDictionary = new() {
            { "miramar", HeadsetType.Quest1 },
            { "hollywood", HeadsetType.Quest2 },
            { "eureka", HeadsetType.Quest3 } };

        if (Application.platform == RuntimePlatform.Android)
        {
            textDeviceName.text = SystemInfo.deviceModel;

            if (SystemInfo.deviceModel == "Oculus Quest")
            {
                var build = new AndroidJavaClass("android.os.Build");
                var device = build.GetStatic<string>("DEVICE");

                HeadsetType headsetType = HeadsetType.Quest2;

                if (headsetDictionary.ContainsKey(device))
                {
                    headsetType = headsetDictionary[device];
                }

                textHeadset.text = headsetType.ToString();
            }

        }
    }
}
3 Likes

Worked like a charm ! Thx mate

1 Like

Thankyou. I just encountered how difficult it is to detect the specific device/controller model when using Meta OpenXR…
You can also add “seacliff” for Quest Pro.

Here’s what I ended up with:

private enum SupportedHeadset
{
    None,
    Quest1,
    Quest2,
    QuestPro,
    Quest3
}

private static bool TryGetHeadset(out SupportedHeadset headset)
{
    using (AndroidJavaClass build = new AndroidJavaClass("android.os.Build"))
    {
        string device = build.GetStatic<string>("DEVICE");
        headset = device switch
        {
            "miramar" => SupportedHeadset.Quest1,
            "hollywood" => SupportedHeadset.Quest2,
            "seacliff" => SupportedHeadset.QuestPro,
            "eureka" => SupportedHeadset.Quest3,
            _ => SupportedHeadset.None
        };
        if (headset == SupportedHeadset.None)
        {
            Debug.LogWarning($"Unable to find determine quest device model for build device: {device}");
        }
        return headset != SupportedHeadset.None;
    }
}
1 Like

Fantastic work here and most amusing that it’s necessary :rofl:

Using everything I’ve learnt, the above code is so far the best.

This is the output from my Quest 2 and 3 of every item of info I can find. This forums code result is at the bottom.


Check out the differences there between Q2 and Q3 - no I don’t own a Pro, or a Placeholder_10 for that matter!