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
0
votes
0 answers

How to perform instrumentation tests on ActionCallback in Android?

I have an Android GlanceAppWidget and would like to test the onAction in its ActionCallback. What is the best way to trigger the code in onAction for instrumentation testing? The below code illustrates what I am trying to do. @Test fun…
mars8
  • 770
  • 1
  • 11
  • 25
0
votes
1 answer

How to implement base class that takes object and class as parameter for Glance Widgets?

I am trying to create a base class GenericAction to handle Glance widget updates. It needs to take two parameters: an Object GlanceStateDefinition and Class GlanceAppWidget() as each widget will have a different state definition and broadcast…
mars8
  • 770
  • 1
  • 11
  • 25
0
votes
1 answer

Jetpack Glance widget open app on tap sometimes results in crashes and when it is not, backstack is empty

I know that it is not the best title in the world but let me explain the problem first, I have implemented a Glance widget with some items in it and when you press them, the app should be opened and navigated to the specific screen given via…
0
votes
1 answer

Where can I find examples of testing interactions with android homescreen widgets?

I see very little information on how to test RemoteViews. For example, I have used UiAutomator to place an app widget on the homescreen and now i want to test if it updates correctly when I click on it. Does anybody know good resources and examples…
0
votes
1 answer

How to do scrollable clickable text in Glance widget?

I want to do the following: Column(modifier = modifier.verticalScroll().clickable( onClick = actionStartActivity(MainActivity::class.java) )) { Text(text = "some really long text") } The problem is that there is no verticalScroll modifier,…
jc12
  • 1,411
  • 1
  • 18
  • 24
0
votes
1 answer

Glance App Widget state not saved inside CoroutineWorker

I want to update my Glance App Widget state inside CoroutineWorker: class MyWorker(appContext: Context, workerParams: WorkerParameters) : CoroutineWorker(appContext, workerParams) { override suspend fun doWork(): Result { val…
0
votes
0 answers

Android widget OnReceive() being called multiple times when running WorkManager request

I have an app which has a home screen widget via GlanceAppWidget(). I would like to run a worker inside the Content() function of GlanceAppWidget(). I have used enqueue(work) from WorkManager api to successfully execute my worker. The problem is…
mars8
  • 770
  • 1
  • 11
  • 25
0
votes
2 answers

How to use WorkManager with Glance composable?

In the the below medium article written by a Google Android Engineer, it states that the best way to fetch data in a glance widget is to use WorkManager. The best way to fetch data asynchronously from the background is by using WorkManager and…
mars8
  • 770
  • 1
  • 11
  • 25
0
votes
1 answer

How to show an Image via URI for an android glance widget

I have an android homescreen widget created with the new Glance api which contains a lazy column. Each row in the column displays an image with ImageProvider(contentUri). The image has been retrieved from a URL with Glide and saved to internal…
mars8
  • 770
  • 1
  • 11
  • 25
0
votes
2 answers

How to pass custom model list to Jetpack Glance Widget?

I want to pass custom model list to glance widget but when i send to list and update widget then widget is re-creating.How can i pass custom model list to glance widget.My github project url in below.The purpose of my project is list of last 10 post…
Mehmet Peker
  • 415
  • 5
  • 10
0
votes
3 answers

Crash in glance app widget image when trying to display bitmap

When I try to display a bitmap image (of my app icon) in the app, it works ok, but crashes when I try to display it in Widget Glance. This is my code for bitmap: val icon = packageManager.getApplicationIcon("com.myapp.packagename") val…
0
votes
1 answer

Refusing your app's TextStyle in a Glance widget

In a glance Text(), there's a style attribute, and this takes a glance TextStyle. This TextStyle is different to the TextStyle you use in your MaterialTheme. So you can't reuse your app's TextStyles. Is it possible to reuse your app's TextStyles in…
mmm111mmm
  • 3,607
  • 4
  • 27
  • 44
-1
votes
1 answer

Bug in actionStartActivity by using Row or Column in GlanceAppWidget

Component used: GlanceAppWidget Library & Version used: androidx.glance:glance-appwidget:1.0.0-alpha03 In the Row and Column if we have more than 1 button onClick and if we use actionStartActivity and pass the intent and parameters, it will take the…
-1
votes
1 answer

Why is onReceive called multiple times?

I am running a worker in a glance composable on android. why is onReceive being continuously called in an infinite loop? What am I missing here? class MyWidget : GlanceAppWidget() { @Composable override fun Content() { val work =…
1 2 3
4