Repository navigation
Conversation
- 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> |
There was a problem hiding this comment.
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.
| protobuf = "0.10.0" | ||
| firebaseCrashlyticsBuildtools = "3.0.7" | ||
| uwb = "1.0.0" | ||
| remoteCompose = "1.0.0-alpha20" |
There was a problem hiding this comment.
yes, very dangerous!
Android Pet widget boilerplate code.