Skip to content

feat: allow configuring widgetCategory - #153

Open
lebowr wants to merge 1 commit into
sAleksovski:masterfrom
lebowr:feat/widget-category
Open

feat: allow configuring widgetCategory#153
lebowr wants to merge 1 commit into
sAleksovski:masterfrom
lebowr:feat/widget-category

Conversation

@lebowr

@lebowr lebowr commented Aug 30, 2026

Copy link
Copy Markdown

Motivation

The generated appwidget-provider XML hardcodes android:widgetCategory="home_screen", so a widget built with this library cannot declare itself eligible for the lock screen.

Android shows third-party widgets on the lock screen from Android 16 QPR2 (and on some tablets from Android 15 QPR1). Widgets are eligible by default there, but a host that filters on the declared category only offers widgets that name it — and there was no way to opt in, nor to opt out with not_keyguard.

Today the only workaround is patch-package on app.plugin.js, which is how I found this.

Change

Adds an optional widgetCategory to the Widget config type, used by the XML template:

widgetCategory?: 'home_screen' | 'keyguard' | 'home_screen|keyguard' | 'not_keyguard';
{
  name: 'Single',
  minWidth: '110dp',
  minHeight: '40dp',
  widgetCategory: 'home_screen|keyguard',
}

Backward compatible: it falls back to 'home_screen', so generated XML is byte-identical for every existing config.

Verification

I've been running the equivalent change as a patch in a shipping app with three widgets. After expo prebuild, all three providers generate:

android:widgetCategory="home_screen|keyguard"

and adb shell dumpsys appwidget reports widgetCategory=3 (HOME_SCREEN|KEYGUARD). Home-screen behaviour is unchanged — launchers ignore the extra bit.

I did not add a test, since src/__tests__ is currently it.todo('write a test') and the plugin has no test harness to extend; happy to add one if you'd like to seed that.

Docs

Added the attribute to the manual-registration tutorial's attribute list, alongside updatePeriodMillis and friends.

References

The generated appwidget-provider XML hardcoded
android:widgetCategory="home_screen", so a widget could not declare
itself eligible for the lock screen.

Android shows third-party widgets on the lock screen from Android 16
QPR2, and on some tablets from Android 15 QPR1. Widgets are eligible by
default there, but a host that filters on the declared category only
offers widgets naming it, and there was no way to opt in — or, with
not_keyguard, to opt out.

Defaults to home_screen, so generated XML is unchanged unless the new
option is set.
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.

1 participant