{"id":18456391,"url":"https://github.com/nicosnicolaou16/androidwidgetwithcompose","last_synced_at":"2025-07-27T15:41:19.946Z","repository":{"id":224326083,"uuid":"755746660","full_name":"NicosNicolaou16/AndroidWidgetWithCompose","owner":"NicosNicolaou16","description":"This project sets up the Widget in Android using Jetpack Compose Glance.","archived":false,"fork":false,"pushed_at":"2024-12-28T22:39:17.000Z","size":162,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T06:41:22.472Z","etag":null,"topics":["android","android-app","android-compose","android-widget","compose","kotlin","widget"],"latest_commit_sha":null,"homepage":"https://medium.com/@nicosnicolaou/android-widget-setup-with-jetpack-compose-glance-with-a-flutter-example-e07fb63c9466","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NicosNicolaou16.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-10T23:18:19.000Z","updated_at":"2024-12-28T22:39:17.000Z","dependencies_parsed_at":"2024-02-25T10:43:25.350Z","dependency_job_id":"93ed2615-abe1-496f-8412-53505513bc7c","html_url":"https://github.com/NicosNicolaou16/AndroidWidgetWithCompose","commit_stats":null,"previous_names":["nicosnicolaou16/androidwidgetwithcompose"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicosNicolaou16%2FAndroidWidgetWithCompose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicosNicolaou16%2FAndroidWidgetWithCompose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicosNicolaou16%2FAndroidWidgetWithCompose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicosNicolaou16%2FAndroidWidgetWithCompose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NicosNicolaou16","download_url":"https://codeload.github.com/NicosNicolaou16/AndroidWidgetWithCompose/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247779796,"owners_count":20994569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-app","android-compose","android-widget","compose","kotlin","widget"],"created_at":"2024-11-06T08:11:22.614Z","updated_at":"2025-07-27T15:41:19.940Z","avatar_url":"https://github.com/NicosNicolaou16.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Android Widget With Compose\n\nThis project sets up the Widget in Android using Jetpack Compose Glance.\n\n# Setup\n\n## Step 1 add the follow dependencies libraries\n\n```Kotlin\nval composeGlanceWidgetVersion by extra(\"1.1.1\")\n\ndependencies {\n\n    //...\n    //Glance Widget\n    implementation(\"androidx.glance:glance-appwidget:$composeGlanceWidgetVersion\")\n    //Using Material 2\n    implementation(\"androidx.glance:glance-material:$composeGlanceWidgetVersion\")\n    //Using Material 3\n    implementation(\"androidx.glance:glance-material3:$composeGlanceWidgetVersion\")\n}\n```\n\n## Steps 2 Create the Glance Receiver class that extend GlanceAppWidgetReceiver() and return the Widget Class\n\n```Kotlin\nclass MyAppWidgetReceiver : GlanceAppWidgetReceiver() {\n    override val glanceAppWidget: GlanceAppWidget\n        get() = MyAppWidget()\n}\n```\n\n## Step 3 Create the xml file into the xml directory (configuration to declare the size etc.)\n\n```XML\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cappwidget-provider xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:initialLayout=\"@layout/glance_default_loading_layout\" android:minWidth=\"250dp\"\n    android:minHeight=\"50dp\" android:resizeMode=\"horizontal|vertical\"\n    android:widgetCategory=\"home_screen\"\u003e\n\u003c/appwidget-provider\u003e\n```\n\n## Step 4 Register the Receiver Class into the Manifest and set the xml configuration for the Glance Widget\n\n```XML\n\n\u003creceiver android:name=\".glance_widget.receiver.MyAppWidgetReceiver\" android:exported=\"true\"\u003e\n    \u003cintent-filter\u003e\n        \u003caction android:name=\"android.appwidget.action.APPWIDGET_UPDATE\" /\u003e\n    \u003c/intent-filter\u003e\n    \u003cmeta-data android:name=\"android.appwidget.provider\"\n        android:resource=\"@xml/my_app_widget_info\" /\u003e\n\u003c/receiver\u003e\n```\n\n## Step 5 Create the Widget that extend GlanceAppWidget() class\n\n```Kotlin\n//...\nclass MyAppWidget : GlanceAppWidget() {\n\n    override suspend fun provideGlance(context: Context, id: GlanceId) {\n        provideContent {\n            MyContent(context) //Compose UI\n        }\n    }\n    //....\n}\n```\n\u003e [!IMPORTANT]  \n\u003e Check my article for the setup :point_right: [Android Widget Setup with Jetpack Compose Glance (with a Flutter example) - Medium](https://medium.com/@nicosnicolaou/android-widget-setup-with-jetpack-compose-glance-with-a-flutter-example-e07fb63c9466) :point_left: \u003cbr /\u003e\n\n\u003e [!IMPORTANT]\n\u003e Similar project with (Dart Language) :point_right: [Android_Widget_With_Compose_With_Flutter](https://github.com/NicosNicolaou16/Android_Widget_With_Compose_With_Flutter) :point_left: \u003cbr /\u003e\n\n# Versioning\n\nTarget SDK version: 35 \u003cbr /\u003e\nMinimum SDK version: 28 \u003cbr /\u003e\nKotlin version: 2.1.21 \u003cbr /\u003e\nGradle version: 8.10.1 \u003cbr /\u003e\n\n# References\n\nhttps://developer.android.com/jetpack/compose/glance/create-app-widget  \u003cbr /\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicosnicolaou16%2Fandroidwidgetwithcompose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicosnicolaou16%2Fandroidwidgetwithcompose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicosnicolaou16%2Fandroidwidgetwithcompose/lists"}