Skip to content

Android Pet boilerplate - #478

Merged
ashnohe merged 3 commits into
mainfrom
rc_widget
Oct 8, 2026
Merged

ashnohe merged 3 commits into
mainfrom
rc_widget

Conversation

@ashnohe

@ashnohe ashnohe commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Android Pet widget boilerplate code.

  • Creates a basic Remote Compose widget that says, "Android Pet Coming Soon"
  • Adds dependencies that will be used in the project
  • Creates a fallback layout that urges the user to view the widget on an Android 17 or higher device

- Add Remote Compose 1.0.0-alpha20 dependencies to libs.versions.toml and appwidgets module
- Implement basic AndroidPetWidget using RemoteComposeWidget with centered RemoteText
- Register AndroidPetWidget in AndroidManifest.xml and configure android_pet_widget_info.xml
- Update overrideLibrary in app and appwidgets manifests for minSdk compatibility
- Create android_pet_widget_fallback.xml layout showing Android 17+ requirement
- Add android_pet_widget_fallback_message string
- Update android_pet_widget_info.xml initialLayout to use the fallback layout
<!-- Remote Compose Android Pet Widget -->
<string name="appwidget_android_pet_name">Android Pet</string>
<string name="android_pet_widget_description">An animated interactive pet widget powered by Remote Compose.</string>
<string name="android_pet_widget_fallback_message">Remote Compose widgets work on Android 17 and higher devices. Use an Android 17 device.</string>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this would appear in the widget list even for < 17 devices? Can we just not show it based on OS version conditions. Apparently it's possible and can be done in Application.onCreate

via LLM

val componentName = ComponentName(context, MyWidgetProvider::class.java)
val desiredState = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CINNAMON_BUN) {
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
} else {
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
}

// Only update if the current state differs
if (context.packageManager.getComponentEnabledSetting(componentName) != desiredState) {
context.packageManager.setComponentEnabledSetting(
componentName,
desiredState,
PackageManager.DONT_KILL_APP
)
}

Note I didn't verify this and we don't need to do it in this change list but maybe a TODO if it is possible.

Comment thread gradle/libs.versions.toml
protobuf = "0.10.0"
firebaseCrashlyticsBuildtools = "3.0.7"
uwb = "1.0.0"
remoteCompose = "1.0.0-alpha20"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alpha..danger danger. 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, very dangerous!

@ashnohe
ashnohe merged commit e9b47e9 into main Oct 8, 2026
8 checks passed
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