Questions tagged [glance-appwidget]

Use this tag to ask questions for Jetpack Glance for AppWidget

API reference for Jetpack Glance for AppWidget: https://developer.android.com/reference/kotlin/androidx/glance/appwidget/package-summary

Code samples and guidance: https://github.com/android/user-interface-samples/tree/glance/AppWidget/glance-widget

59 questions
1
vote
1 answer

Jetpack Glance Widget: Scroll to specific item in LazyColumn

I have the widget that fetch and display the list of data via LazyColumn. After the data loaded, I want the LazyColumn to scroll to specific item. In Jetpack Compose we have LazyListState but do we have something similar in Glance? (or any…
1
vote
2 answers

Rounded corners of image in Jetpack Glance Widget

Is there any way how to make image corners in Jetpack Glance Widget rounded? I know there is a GlanceModifier method cornerRadius, but this is available only in higher versions (S+).
1
vote
1 answer

How to load bitmap to Glance composable via Coil Uri?

I am following the sample code from ImageGlanceWidget to load a bitmap to Glance via Uri. As mentioned in the comments from this answer I have replaced getImageProvider() method with below code. However, when I do this I get error: Error in Glance…
mars8
  • 770
  • 1
  • 11
  • 25
1
vote
0 answers

Corner radius is not working in Jetpack Glance Widget

My Glance image is set like this: Image( provider = ImageProvider( bitmap ), contentDescription = "Image", modifier = GlanceModifier .size(70.dp) .imageCornerRadius() .clickable( …
1
vote
1 answer

How to inject parameters into Android Worker that are only known at runtime?

Goal How can I pass myObject and myClass parameters to GlanceWorker below? Background I am using android-workmanager to run background tasks. These tasks are initialized from a home screen widget which I have added with Glance. As recommended by…
mars8
  • 770
  • 1
  • 11
  • 25
1
vote
2 answers

Injecting Context into a Broadcast Receiver using Hilt/Dagger?

I am using context() in my GlanceAppWidget() for tasks like retrieving glanceId and updating app widget state. I am having issue with how I inject the context object. I would like to use the dagger/hilt framework to inject the context into my…
mars8
  • 770
  • 1
  • 11
  • 25
1
vote
0 answers

Best way to replicate a Canvas in Glance Widget?

In Compose we have the method Canvas() to draw lines etc. Is there a similar feature in Glance? If not, what would be the best way to replicate the Canvas functionality?
mars8
  • 770
  • 1
  • 11
  • 25
1
vote
1 answer

GlanceAppWidget with clickable row: inner elements steal focus and clicks

I have a widget made with a android glance library. There is a Row contains Image and Text. I need to make this row clickable. Row( verticalAlignment = Alignment.CenterVertically, modifier =…
E I
  • 501
  • 4
  • 13
1
vote
0 answers

Create URI to a file using android Uri.Builder() function

I am new to using Uri's to locate files on the emulators storage in android studio. I have a png file saved in the android emulators data/data/com.domain.appname/files directory. I would like to create the uri for this file using android's…
mars8
  • 770
  • 1
  • 11
  • 25
1
vote
1 answer

Glance fails to load images using the coil

I did this in Glance to get a bitmap of the online URI for display, but it failed. Does Glance still support weight ratios? val context = LocalContext.current val imageLoader = ImageLoader(context) var bitmap =…
花未开
  • 159
  • 1
  • 6
1
vote
1 answer

How to identify multiple instances of Glance App Widget

I am trying to create a widget which shows information about a hardware device. There can be multiple of these devices and user will be able to add same widget for different devices. I am looking for a way to understand which device information…
mehmet6parmak
  • 4,777
  • 16
  • 50
  • 71
1
vote
6 answers

How to update the AppWidgetState of a Compose Glance Widget from a Configuration/Main Activity?

My latest idea was to use updateAppWidgetState(context = context, definition = PreferencesGlanceStateDefinition, glanceId = glanceId) { // ... } and GlanceWidget().update(context = context, glanceId = glanceId) but I don't have access to…
1
vote
1 answer

How to have a toast show on an onClick in a Compose Glance widget?

One of the first things I like to do with any hello world app/UI is to have some sort of popup or toast. It seems like listeners in Glance are fairly limited to a set of action types. How can display something simple like a toast onClick? Is the…
c_idle
  • 1,448
  • 4
  • 22
  • 40
0
votes
1 answer

How to Make Unique DataStore for each glance widget?

While trying to use the WeatherApp Sample, I am not understanding how I would change it so that each widget did infact use it's own datastore, rather than a shared one. My understanding is that datastore as it is in the sample below, are saved to…
ddxv
  • 23
  • 5
0
votes
0 answers

Android Glance App Widget - dynamic resizing discrapencies

I have a widget that can render either one month or two months widget (based on size availability). On API 33, it allows me to resize, but on API 32, it does not render 1 month widget. API 32 (does not work): API 33 (works): class…
andude
  • 500
  • 1
  • 5
  • 11