Web Requests Fail on Android Meta Quest 2 Only
Asked Answered
H

5

0

I am experiencing web request failures that only occur on the Meta Quest 2 VR headset.
The requests return successfully in the Editor, in Desktop builds and in regular non-VR Android builds.

I have created a Unity 2022 LTS project, based on the VR Template provided in Unity Hub, and configured it for the Quest.
The headset has been configured with developer mode and all requirements have been installed.
After connecting the headset through cable, build and deployments work fine and I can navigate the sample scene.

The issue occurs on any type of HTTP request I make through scripting.
I have tested with UnityWebRequest and .NET’s HttpClient.
UnityWebRequest returns a "Cannot resolve destination host" network error with "ConnectionError" as a message result, whereas HttpClient causes a "WebException: Error: NameResolutionFailure".

What I’ve tried:

  • Using different destination hosts (my own Servers, Google images or public Json REST APIs)
  • Using http or https
  • Enabling a custom AndroidManifest.xml and adding "android.permission.INTERNET" and "android.permission.ACCESS_NETWORK_STATE" to it
  • Ensuring the correct Android Permissions are requested by the app to the user prior to the web requests
  • Ensuring OpenXR is being used and “Meta Quest Support” is enabled
  • Disabling "Force Remove Internet Permission" under Project Settings > XR Plug-in Management > OpenXR > Meta Quest Support
  • Enabling "Require" under Project Settings > Player > Other Settings > Configuration > Internet Access

I have also tried deploying the app to a different Meta Quest on a different network and the issue persists.
I’ve ran out of ideas and could use some help determining what am I doing wrong.

Below I leave some links to related topics:

Horne answered 30/8, 2023 at 15:20 Comment(1)

All the mods seeing post like this:

Patsypatt
W
0

I’m having the exact problem, any solution :(?

Wb answered 30/8, 2023 at 15:23 Comment(0)
W
0

Are you sending http petitions or https? If they are http you have to add android:usesCleartextTraffic=“true” to the manifest :smiley:

Wb answered 30/8, 2023 at 15:53 Comment(0)
H
0

@Wb No solution yet… I’m using https, but thanks for the tip!

Horne answered 30/8, 2023 at 17:55 Comment(1)

Maybe... have you checked if the IP of the device is not the same as the one you are making the request to?

Wb
W
0

What I do now and it works is changing the manifest to an erroreous one (for example, changing manifest for manifesta) and trying to build. Unity will tell you that the build went wrong, and then I change the Android Manifest again to make it work

Wb answered 1/10, 2023 at 20:2 Comment(1)

@Wb the Unity Manifest or Android Manifest? The Android Manifest seems to be compiled along with the rest of the build and does not exist in the project files, I tried changing the manifest.json name, but that just crashed the editor and did not seem to help.

Mapes
M
0

While its not a solution, I found a thread that confirms this is a problem and that it comes from an option in OpenXR to “force disable Internet” that apparantly keeps activating itself. It might fix it to make a custom manifest, but for some reason that might not even be enough, at least it does not work very well for me.

But at least it has been reported to Unity.
https://forum.unity.com/threads/unity-removes-android-permission-internet-in-the-build-apk-after-build-is-completed.1466654/

Mapes answered 18/10, 2023 at 8:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.