Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

PWA Player: Send PWA installation status as broadcast to all eligible apps

Sayantan Roychowdhury requested to merge 4945-pwa_broadcast into master

Description

Broadcast PWA install / removal status.
3 broadcasts are defined:

  • foundation.e.pwaplayer.PWA_ADDED
  • foundation.e.pwaplayer.PWA_CHANGED
  • foundation.e.pwaplayer.PWA_REMOVED

Issue(s)

https://gitlab.e.foundation/e/backlog/-/issues/4945

Test environment

Gradle build against 4945-pwa_broadcast branch, install the apk into the device

Test procedures

Any custom app can be made with a broadcast receiver as is shown in the file:
https://gitlab.e.foundation/e/os/pwa-player/-/blob/4945-pwa_broadcast/app/src/main/java/foundation/e/pwaplayer/broadcast/PWAStatusBroadcast.kt
On any PWA installation or removal, the custom broadcast receiver will receive an update.

An small code example is present here: PWA broadcast and launch test

Technical details

Initially it was thought to broadcast PACKAGE_ADDED / PACKAGE_REMOVED like for apk installation. But this might interfere with other apps which depend on this broadcast as well as conflict with the android system.

The PWA specific broadcast actions are:

  • foundation.e.pwaplayer.PWA_ADDED
  • foundation.e.pwaplayer.PWA_CHANGED
  • foundation.e.pwaplayer.PWA_REMOVED

Intent extras for each broadcast include:

  1. SHORTCUT_ID - string shortcut id.
  2. URL - string url of the pwa. This is to be set as Intent data to launch the PWA.
  3. PWA_ID - long type id of the PWA in PWA Player database. This id is needed to launch a PWA.

(PWA_ID is available after merging MR: !3 (merged))

Screenshots

Check list

  • Self review
  • Test procedure explained
  • Tested on fresh install
  • Tested applied as an update
  • License
  • Internal documentation
  • User documentation
Edited by Sayantan Roychowdhury

Merge request reports

Loading