Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Research] Generate Oculus Store compatible APKs #615

Closed
FluorescentHallucinogen opened this issue Nov 5, 2021 · 15 comments
Closed

[Research] Generate Oculus Store compatible APKs #615

FluorescentHallucinogen opened this issue Nov 5, 2021 · 15 comments

Comments

@FluorescentHallucinogen
Copy link
Contributor

FluorescentHallucinogen commented Nov 5, 2021

Initial request

https://twitter.com/ThePra9/status/1455899334365618181

Current plan

  1. Check if APK generated by Oculus CLI uses TWA (Trusted Web Activity):
    1.1. Generate APK using Oculus CLI:
./ovr-platform-util create-pwa
  -o output.apk
  --android-sdk /opt/android_sdk
  https://example.com/manifest.webmanifest

Or to use local manifest file:

--manifest-content-file manifest.webmanifest
  https://example.com/
  1. Check if Oculus supports TWA (Trusted Web Activity):
    2.1. Generate APK using Bubblewrap (PWABuilder), try to publish it to Oculus Store via Oculus CLI or web interface (see https://developer.oculus.com/resources/publish-reference-platform-command-line-utility/#upload-quest) and make some changes to APK source code to fix errors/warnings (see https://developer.oculus.com/resources/publish-mobile-manifest/#specs).
    2.2. Compare APK generated by Oculus CLI with APK generated by Bubblewrap (AndroidManifest.xml, etc.).
    2.3. Check APK with fixes published to Oculus Store on real Oculus device.

  2. Create a pull request for Bubblewrap.

  3. Create a pull request for PWABuilder.

  4. Write docs. E.g. document new vendor-specific proprietary web app manifest members such as:

"ovr_scope_extensions": [
  {"pattern": "*.example.com"}
]

and

"ovr_multi_tab_enabled" : true

Notes

This should be an option to not affect APKs for other app stores.

@andreban
Copy link
Member

andreban commented Nov 5, 2021

On 1, if someone can share an APK generated by the Oculus CLI I'm happy to check it out.

@FluorescentHallucinogen
Copy link
Contributor Author

Hmm, for some reason I have no create-pwa command in ovr-platform-util: https://twitter.com/alexey_rodionov/status/1456689833380827137. 🤔

@jacobrossi PTAL.

@arpu
Copy link

arpu commented Nov 5, 2021

the cli is https://developer.oculus.com/documentation/web/pwa-packaging/#download-the-cli
mac and widows version the zip has a pwa-template.apk included

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented Nov 6, 2021

@andreban

Here's APK: https://drive.google.com/file/d/1IAw8M0kc695GiawnBAvijfqzohrWHPbJ

I'm almost 100% sure it's not a TWA. :)

And here it's AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionCode="1"
    android:versionName="1.0"
    android:compileSdkVersion="23"
    android:compileSdkVersionCodename="6.0-2438415"
    package="com.airhorner"
    platformBuildVersionCode="29"
    platformBuildVersionName="10">

    <uses-sdk
        android:minSdkVersion="23"
        android:targetSdkVersion="29" />

    <uses-feature
        android:name="android.hardware.vr.headtracking"
        android:required="false"
        android:version="1" />

    <uses-feature
        android:name="oculus.software.handtracking"
        android:required="false" />

    <uses-permission
        android:name="com.oculus.permission.HAND_TRACKING" />

    <application
        android:theme="@ref/0x7f0d0005"
        android:label="The Air Horner"
        android:icon="@ref/0x7f0b0000"
        android:debuggable="false"
        android:allowBackup="false"
        android:supportsRtl="true"
        android:extractNativeLibs="false"
        android:roundIcon="@ref/0x7f0b0001"
        android:appComponentFactory="androidx.core.app.CoreComponentFactory">

        <meta-data
            android:name="web_manifest_url"
            android:value="https://airhorner.com/manifest.json" />

        <meta-data
            android:name="com.oculus.pwa.START_URL"
            android:value="https://airhorner.com/?homescreen=1" />

        <meta-data
            android:name="com.oculus.pwa.SCOPE"
            android:value="https://airhorner.com/" />

        <meta-data
            android:name="com.oculus.pwa.NAME"
            android:value="The Air Horner" />

        <meta-data
            android:name="com.oculus.pwa.APPID"
            android:value="@string/0x15" />

        <meta-data
            android:name="com.oculus.vrshell.supports_free_resizing"
            android:value="true"
            maxSizeX="1280"
            maxSizeY="1000"
            minSizeX="400"
            minSizeY="400" />

        <meta-data
            android:name="com.oculus.pwa.SHORT_NAME"
            android:value="Airhorner" />

        <meta-data
            android:name="com.oculus.pwa.DESCRIPTION"
            android:value="The world's best airhorner, and it's free" />

        <meta-data
            android:name="com.oculus.pwa.ICONS"
            android:value="[{"src":"/images/touch/android-launchericon-48-48.png","type":"image/png","sizes":"48x48"},{"src":"/images/touch/android-launchericon-72-72.png","type":"image/png","sizes":"72x72"},{"src":"/images/touch/android-launchericon-96-96.png","type":"image/png","sizes":"96x96"},{"src":"/images/touch/android-launchericon-144-144.png","type":"image/png","sizes":"144x144"},{"src":"/images/touch/android-launchericon-192-192.png","type":"image/png","sizes":"192x192"},{"src":"/images/touch/android-launchericon-512-512.png","type":"image/png","sizes":"512x512"},{"src":"/images/touch/android-maskableicon-48-48.png","type":"image/png","sizes":"48x48","purpose":"maskable"},{"src":"/images/touch/android-maskableicon-72-72.png","type":"image/png","sizes":"72x72","purpose":"maskable"},{"src":"/images/touch/android-maskableicon-96-96.png","type":"image/png","sizes":"96x96","purpose":"maskable"},{"src":"/images/touch/android-maskableicon-144-144.png","type":"image/png","sizes":"144x144","purpose":"maskable"},{"src":"/images/touch/android-maskableicon-192-192.png","type":"image/png","sizes":"192x192","purpose":"maskable"},{"src":"/images/touch/android-maskableicon-512-512.png","type":"image/png","sizes":"512x512","purpose":"maskable"}]" />

        <meta-data
            android:name="com.oculus.pwa.SCREENSHOTS"
            android:value="[{"src":"/images/screenshots/1-360x640.png","type":"image/png","sizes":"1080x1920"},{"src":"/images/screenshots/2-360x640.png","type":"image/png","sizes":"360x640"}]" />

        <meta-data
            android:name="com.oculus.pwa.DISPLAY"
            android:value="standalone" />

        <meta-data
            android:name="com.oculus.pwa.BACKGROUND_COLOR"
            android:value="rgb8(0xff2196f3)" />

        <meta-data
            android:name="com.oculus.pwa.THEME_COLOR"
            android:value="rgb8(0xff2196f3)" />
    </application>
</manifest>

I've tried to run it in Android emulator and got the following error:

Could not identify launch activity: Default Activity not found
Error while Launching activity
Failed to launch an application on all devices

@andreban
Copy link
Member

andreban commented Nov 8, 2021

Interesting - despite being ~1mb in side, the Android Manifest doesn't have any Activity and neither does the code in classes.dex. They could make it much smaller by dropping the androidx dependencies.

Overall, their approach seems to be similar to how Trusted Web Activity works on Chrome OS on some scenarios - when the application is installed, Chrome OS reads the APK and extracts the information shipped within the app to generate an installed PWA - Bubblewrap ships a copy of the Web Manifest inside the APK.

@FluorescentHallucinogen
Copy link
Contributor Author

FluorescentHallucinogen commented Nov 9, 2021

Interesting - despite being ~1mb in side, the Android Manifest doesn't have any Activity and neither does the code in classes.dex. They could make it much smaller by dropping the androidx dependencies.

@davehill00 @jacobrossi @cabanier FYI. 😉

BTW, @jacobrossi @cabanier Does Oculus Browser supports TWA (Trusted Web Activity)?

@JohnRSim
Copy link

Anyone made any progress - any examples walkthroughs?

@FluorescentHallucinogen
Copy link
Contributor Author

I'm still working on it. The problem is I don't have my own Oculus device. So I ask my friend who has the device to check some things for me.

Along the way, I check what PWA features on Oculus works and what doesn't. See immersive-web/webxr-samples#135. 😉

That's why it's so slow. :)

@JohnRSim
Copy link

If you need another device I have Quest2 I can test with for you.

@G8342
Copy link

G8342 commented Dec 1, 2021

@FluorescentHallucinogen
Copy link
Contributor Author

Good news! I finally own Quest 2. 😊

ICYMI, preview version of PWABuilder (https://preview.pwabuilder.com) offers packaging PWA for Oculus Store. 😉

@tomayac cc.

It uses ovr-platform-util under the hood. Here's the repo: https://github.com/pwa-builder/pwabuilder-oculus.

@FluorescentHallucinogen
Copy link
Contributor Author

I've also checked TWA on Quest 2. I've sideloaded APK via ADB and opened it via "Unknown Sources" section. And it just opened in Oculus Browser just like regular website (not in standalone mode).

I've also sideloaded Google Chrome APK to Quest 2. :) If Chrome is installed, then TWA open in it in standalone mode (instead of Oculus Browser).

@tomayac
Copy link
Member

tomayac commented Apr 5, 2022

Oh, thanks for sharing, @FluorescentHallucinogen. That's really a nice feature addition to PWABuilder!

@FluorescentHallucinogen
Copy link
Contributor Author

For anyone who's interested:

Packaging PWAs for Quest with PWABuilder is officially released in stable channel: https://twitter.com/pwabuilder/status/1529191206919491586.

It's the recommended way to package PWAs for Quest: https://developer.oculus.com/documentation/web/pwa-building-with-pwabuilder/.

So I've updated @tomayac's “PWAs on Oculus Quest 2” blog post: https://web.dev/pwas-on-oculus-2/.

I've reduced the size of pwa-template.apk by 1000x, from 1.2 MB to 1.2 kB! See my PWABuilder pull request for details: pwa-builder/pwabuilder-oculus#7.

The pwa-template.apk is used in ovr-platform-util CLI that is used in PWABuilder under the hood for Packaging PWAs for Quest.

I've finally got my hands on working on pull request that adds to Bubblewrap a flag for generating universal APKs compatible with Quest that open Trusted Web Activity (TWA) on regular Android devices and open Meta Quest Browser on Quest devices. This will allow to abandon ovr-platform-util in favor of Bubblewrap.

@FluorescentHallucinogen
Copy link
Contributor Author

See #704. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants