GoogleChromeLabs / bubblewrap

Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWAs) using a Trusted Web Activity.
Apache License 2.0
2.35k stars 161 forks source link

Add the ARcore permission to the Android Manifest when using WebXR #515

Closed michaelvogt closed 2 years ago

michaelvogt commented 3 years ago

Is your feature request related to a problem? Please describe. I created a TWA with PWABuilder. Works so far as expected.

What I just realized is, that the permissions aren't set correctly. The location permission is picked up correctly, but as my app uses WebXR, camera and AR requirements aren't picked up. Reported this on PWABuilder repo but was sent here.

The problem with the missing permission is, that the Play store can't filter the app for devices not capable to run the app. This will likely be frustrating to the user, when the user is told that the app isn't running on the device after installation.

URL to app sparcl.app

Describe the solution you'd like These requirements should likely lead to camera permission and AR feature added to the android manifest. According to ARCore docs, that would look like this:

<application …> …

<!-- "AR Required" app, requires "Google Play Services for AR" (ARCore)
     to be installed, as the app does not include any non-AR features. -->
<meta-data android:name="com.google.ar.core" android:value="required" />

Describe alternatives you've considered Adding the permissions to the Android manifest can probably done when using bubble wrap directly. But would appreciate when this could be handled for PWABuilder, too.

Additional context Camera and AR permissions not included in the generated app package

image

andreban commented 3 years ago

Thanks for filing this issue, @michaelvogt.

I know very little about WebXR, but this seem to imply that WebXR always means ARCore. Is this the case for all browsers (eg: Samsung Internet, Edge, Firefox) and all platforms where TWAs are supported (ie: Android and Chrome OS).

CC @nohe427 @joycetoh8 @ibrahimkarahan Would you know if Chrome OS reports WebXR and if it matches the required field?

michaelvogt commented 3 years ago

Good question. I'm still in the process of making things work, so haven't looked much at compatibility with other browsers.

Maybe this page gives a good overview of Chrome's WebXR compatibility: https://immersiveweb.dev/chrome-support.html

Currently, some Chromium / Blink based browsers are the only browsers that have any 'immersive-ar' features implemented, with Chrome being the most 'complete' (most still behind the WebXR incubation flag). This implementation is running on ARCore compatible devices, as can be seen in the last row of the 'Chrome compatibility table'.

image

Chrome asks to install ARCore when disabled Samsung Internet just throws an exception when ARCore is disabled

Don't know what's happening with Edge, as the remote debugger screen 404s. But looking this page, I understand that they're concentrating on what they call Mixed Reality. https://docs.microsoft.com/en-us/windows/mixed-reality/whats-new/new-microsoft-edge

It will also support WebXR at launch, the new standard for creating immersive web experiences for VR headsets, in place of WebVR.

Firefox has currently only 'immersive-vr' features implemented.

Not sure what the current situation is for Chrome OS. I mean to remember there have been devices listed on the compatibility list. But as of right now, there are none.

I'm only using the 'immersive-ar' module, not sure what the hardware / software requirements are regarding the 'immersive-vr' module of WebXR.

Hope this answers your questions :)

andreban commented 2 years ago

Created #620 that should adds the following to the application section:

<meta-data android:name="com.google.ar.core" android:value="required" />

@michaelvogt is that the only thing that's needed for this to work?

michaelvogt commented 2 years ago

@andreban As far as I know, yes. Thank you

andreban commented 2 years ago

Got it, thank you. I will double check this and maybe there's an opportunity to make the solution more flexible - like allow injecting any metadata name/value into the application.