Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Setup android manifest for VR #7

Merged
merged 1 commit into from
Jun 7, 2021
Merged

Setup android manifest for VR #7

merged 1 commit into from
Jun 7, 2021

Conversation

agrande
Copy link
Contributor

@agrande agrande commented Jun 4, 2021

As documented here:
https://developer.oculus.com/documentation/native/android/mobile-native-manifest/

Using the syntax of cargo-apk 0.7
https://crates.io/crates/cargo-apk

This fixes a few lifecyle issues. In particular, the app can be launched again through the oculus menu.

As documented here:
https://developer.oculus.com/documentation/native/android/mobile-native-manifest/

Using the syntax of cargo-apk 0.7
https://crates.io/crates/cargo-apk

This fixes a few lifecyle issues. In particular, the app can be launched again through the oculus menu.
@blaind
Copy link
Owner

blaind commented Jun 5, 2021

Thank you for the pull request! This is great work, and hopefully fixes #3.

One question though, did you get the Quest 2 example running with cargo-apk 0.7 cargo version, or did you patch it based on the version referred in this repo, or other way? Needed for the Oculus loader .so to be added into the .apk. I see that rust-mobile/ndk#138 is still open.

@agrande
Copy link
Contributor Author

agrande commented Jun 5, 2021

I got it running with the version from the PR linked above (rust-mobile/ndk#138), which is based on 0.7.

I believe it's a different version from the cargo-apk version you used. I have additional local changes to make it work (i.e. libs/aarch64-linux-android => runtime_libs/arm64-v8a and modified build.rs accordingly).

@agrande
Copy link
Contributor Author

agrande commented Jun 5, 2021

I think it partially fixes #3. Seems to work in most cases, but I ran into some situations where it still wouldn't seem to load properly after navigation.
Also, it seems to keep rendering frames even if the app is in the background.

@blaind
Copy link
Owner

blaind commented Jun 5, 2021

Allright, I'll have a look into android-ndk-rs and create a patched version based on 0.7.

Regarding frame loop, in current version the bevy systems actually run even if the app is in the background, but wgpu render should not occur:

How it works currently:

I guess eventually the runner should detect the state, and if not in running state, the runner should poll XR for state changes.

@agrande
Copy link
Contributor Author

agrande commented Jun 6, 2021

Allright, I'll have a look into android-ndk-rs and create a patched version based on 0.7.

Regarding this, I could also clean up my local changes and push them in this PR if you want.

@blaind blaind merged commit cbed4bb into blaind:main Jun 7, 2021
@blaind
Copy link
Owner

blaind commented Jun 7, 2021

No worries, I got it working by merging https://github.com/blaind/android-ndk-rs with the latest upstream master. Also had to a small fix to get hand tracking working again: e1dc316

Tested also with Quest2, lifecycle is remarkably better now. However, there's still the process::exit() which Oculus seem to complain about the app crashing. Also, it doesn't really do proper cleanup of openxr resources in that way.

https://github.com/blaind/bevy_openxr/blob/main/crates/bevy_openxr_core/src/lib.rs#L135

Tried removing the exit, but it seems that for some reason Oculus still tries to launch the main activity multiple times. Commenting out https://github.com/blaind/xrbevy/blob/main/examples/xr_apk_scene.rs#L7 did not help, though.

@blaind blaind mentioned this pull request Jul 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants