Skip to content

feat(live-update): support .br ZIP artifacts on Android#800

Open
mustafa0x wants to merge 3 commits intocapawesome-team:mainfrom
mustafa0x:fix/live-update-brotli-progress
Open

feat(live-update): support .br ZIP artifacts on Android#800
mustafa0x wants to merge 3 commits intocapawesome-team:mainfrom
mustafa0x:fix/live-update-brotli-progress

Conversation

@mustafa0x
Copy link
Copy Markdown

@mustafa0x mustafa0x commented Mar 16, 2026

Summary

  • add Brotli HTTP response support on Android via okhttp-brotli + interceptor
  • add Android support for Brotli-compressed ZIP artifacts served as actual .br files
  • when a zip bundle URL ends with .br, download it and decompress to a temporary ZIP before extraction
  • update README + changeset wording for Brotli support

Tests Run

  1. Android plugin verification

    • Command:
      ANDROID_HOME="$HOME/Library/Android/sdk" ANDROID_SDK_ROOT="$HOME/Library/Android/sdk" GRADLE_OPTS="-Dhttps.protocols=TLSv1.2,TLSv1.3 -Djdk.tls.client.protocols=TLSv1.2,TLSv1.3" mise x java@openjdk-21.0.2 -- npm run verify:android
    • Result: PASS
  2. Runtime test for Brotli HTTP response support (Content-Encoding: br)

    • Android emulator + example app
    • Served ZIP at http://10.0.2.2:8787/bundle.zip with Content-Type: application/zip and Content-Encoding: br
    • Called:
      LiveUpdate.downloadBundle({ artifactType: 'zip', bundleId: 'br-test', url: 'http://10.0.2.2:8787/bundle.zip' })
    • Result: PASS
  3. Runtime test for actual .br artifact support (no Content-Encoding)

    • Android emulator + example app
    • Served Brotli-compressed file at http://10.0.2.2:8787/bundle.br with Content-Type: application/octet-stream and no Content-Encoding header
    • Called:
      LiveUpdate.downloadBundle({ artifactType: 'zip', bundleId: 'br-raw-test', url: 'http://10.0.2.2:8787/bundle.br' })
    • Result: PASS
      • downloadBundle resolved successfully
      • getDownloadedBundles() included br-raw-test
      • server log confirmed GET /bundle.br

@robingenz
Copy link
Copy Markdown
Member

@mustafa0x Thank you for your PR! Please create two separate PRs, as these fixes are unrelated to each other. For the progress listener fix, please also include steps to reproduce the issue so we have more context. Looking forward to merging your PRs.

@mustafa0x mustafa0x changed the title fix(live-update): support Brotli downloads and robust unknown-size progress fix(live-update): add Brotli support for Android downloads Mar 17, 2026
@mustafa0x
Copy link
Copy Markdown
Author

Thanks @robingenz! I simplified.

@mustafa0x mustafa0x force-pushed the fix/live-update-brotli-progress branch from 19e1680 to 38bce36 Compare March 17, 2026 05:38
@robingenz
Copy link
Copy Markdown
Member

@mustafa0x Thank you! How did you test it?

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 17, 2026

Open in StackBlitz

@capawesome/capacitor-age-signals

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-age-signals@800

@capawesome-team/capacitor-android-battery-optimization

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-android-battery-optimization@800

@capawesome/capacitor-android-dark-mode-support

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-android-dark-mode-support@800

@capawesome/capacitor-android-edge-to-edge-support

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-android-edge-to-edge-support@800

@capawesome-team/capacitor-android-foreground-service

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-android-foreground-service@800

@capawesome/capacitor-app-review

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-app-review@800

@capawesome/capacitor-app-shortcuts

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-app-shortcuts@800

@capawesome/capacitor-app-update

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-app-update@800

@capawesome/capacitor-apple-sign-in

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-apple-sign-in@800

@capawesome/capacitor-asset-manager

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-asset-manager@800

@capawesome/capacitor-background-task

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-background-task@800

@capawesome/capacitor-badge

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-badge@800

@capawesome/capacitor-cloudinary

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-cloudinary@800

@capawesome-team/capacitor-datetime-picker

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-datetime-picker@800

@capawesome-team/capacitor-file-opener

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-file-opener@800

@capawesome/capacitor-file-picker

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-file-picker@800

@capawesome/capacitor-google-sign-in

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-google-sign-in@800

@capawesome/capacitor-libsql

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-libsql@800

@capawesome/capacitor-live-update

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-live-update@800

@capawesome/capacitor-managed-configurations

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-managed-configurations@800

@capawesome/capacitor-photo-editor

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-photo-editor@800

@capawesome/capacitor-posthog

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-posthog@800

@capawesome/capacitor-realtimekit

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-realtimekit@800

@capawesome/capacitor-screen-orientation

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-screen-orientation@800

@capawesome/capacitor-screenshot

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-screenshot@800

@capawesome/capacitor-square-mobile-payments

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-square-mobile-payments@800

@capawesome/capacitor-superwall

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-superwall@800

@capawesome/capacitor-torch

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-torch@800

commit: d991af7

@mustafa0x
Copy link
Copy Markdown
Author

running tests in the sim now

@mustafa0x mustafa0x changed the title fix(live-update): add Brotli support for Android downloads feat(live-update): support .br ZIP artifacts on Android Mar 17, 2026
@robingenz
Copy link
Copy Markdown
Member

@mustafa0x Cloudflare should automatically compress all outgoing files using Brotli if the client supports it. So, as far as I know, the .br extension shouldn't be necessary. Please test it directly with Capawesome Cloud. We currently don't plan to add support for the .br extension.

@mustafa0x
Copy link
Copy Markdown
Author

Cloudflare should automatically compress all outgoing files using Brotli if the client supports it.

It doesn't. It uses zstd. Which is good, but not nearly as small. I recently opened an issue with CF noting this: https://community.cloudflare.com/t/cloudlfare-recompresses-brotli-as-zstd-doubling-size/896014

You can test this with curl -I (I don't use capawesome cloud)

And even if CF does compress via brotli, precompressed at the highest level does much better. Again, it's easy to test this. If you point me to a test url I'll investigate myself and give you concrete numbers.

@mustafa0x
Copy link
Copy Markdown
Author

I do advise supporting brotli :)

"Brotli compression saves 1.5 petabytes per day at Google’s Play Store"
https://students.googleblog.com/2017/02/intern-impact-brotli-compression-for.html

@robingenz
Copy link
Copy Markdown
Member

robingenz commented Mar 17, 2026

It would be great if you could give it a try using Capawesome Cloud. The free plan includes live updates. Just upload a bundle using the Capawesome CLI and then compare the download speed of the bundles.

Otherwise, I’ll give it a try myself in the next few days and also check how much effort it would be to support the .br extension directly. Seems like a worthwhile effort. Thanks!

EDIT: What about iOS?

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

Successfully merging this pull request may close these issues.

2 participants