XReal One Pro

Development with the XReal SDK

Setup

Don't forget to update the glasses first:

https://www.xreal.com/ota/

Also, in the SDK tutorials, they will mention a version of Unity3D. This is relevant as the latest Unity3D might not work with the SDK provided.



image.png

Debugging

Enable wireless debugging in Android, then you'll see the IP adress and port to pair.

 

Once paired you can connect to the main debu gport in ADB

image.png

Connecting the glasses in Android

It seems to be a chore at first and depending on your phone, it might or might not work.
Don't look into "desktop mode" etc. 

Issue logged here


Pixel 8 has this toggle in settings "External displays" - and you have to set the checkbox every time you connect.
Xperia 5 does not have this toggle.


Automatic route:

Install the APK and via adb
C:\Users\Tim\AppData\Local\Android\Sdk\platform-tools>
adb shell pm grant com.sophior.screenenabler android.permission.WRITE_SECURE_SETTINGS
adb shell pm grant com.sophior.screenenabler android.permission.DUMP


Manual route;



Analyzing via adb (via wireless debugging), it is this action that is required:

adb shell cmd display enable-display 139

You can find the display id via this one:
adb shell cmd display get-displays

If it is not listed find it here:
adb shell dumpsys display | findstr /i "XREAL HDMI EXTERNAL mDisplayId mIsEnabled state OFF DisplayViewport"

Then, the Android will prompt to "Allow display over other apps", when enabled, the glasses will start up and I can read the parameters in the headtracking and have a 3D app.
When I exit the app, there is the mirroring of Android.


I made this script, but it requires to be connected to the Android phone with adb:

$adb = "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe"
$dump = & $adb shell dumpsys display
$displayId = $null
$currentId = $null
$inExternalBlock = $false
$isXreal = $false
$isDisabled = $false
foreach ($line in $dump) {
    if ($line -match 'mDisplayId=(\d+)') {
        $currentId = $matches[1]
        $inExternalBlock = $false
        $isXreal = $false
        $isDisabled = $false
    }
    if ($line -match 'type EXTERNAL|type=EXTERNAL|mPrimaryDisplayDevice=HDMI Screen|mPrimaryDisplayDevice=XREAL') {
        $inExternalBlock = $true
    }
    if ($line -match 'XREAL One Pro|HDMI Screen') {
        $isXreal = $true
    }
    if ($line -match 'mIsEnabled=false|state OFF|committedState OFF') {
        $isDisabled = $true
    }
    if ($currentId -and $inExternalBlock -and $isXreal -and $isDisabled) {
        $displayId = $currentId
        break
    }
}

if (-not $displayId) {
    Write-Host "No disabled XREAL/external display found."
    exit 1
}

Write-Host "Enabling external display ID $displayId..."
& $adb shell cmd display enable-display $displayId
& $adb shell input keyevent KEYCODE_WAKEUP

Write-Host "Done."