https://kotlinlang.org logo
#glance
Title
# glance
q

Qusai Zakir

02/11/2023, 10:47 PM
When using the new Snapshot glance version - when the widget is left for a while, clicking a button doesn't register on the first click (lamba action), it needs one extra click to 'start' working again. I'm guessing this is related to the session being closed?
👀 1
w

Willie Koomson

02/16/2023, 1:24 AM
Yes, the session closes after some time so there may be a a bit of a delay when it has to start up the worker after another interaction. This shouldn't be more than 0.5s (closer to 0.1-0.25s on average).
However, you shouldn't have to click twice to get it to respond. Do you have any logs under the tag "AppWidgetSession"? It should log a warning if the lambda can't be found
I'll try to reproduce this as well
q

Qusai Zakir

02/16/2023, 10:52 AM
That's correct, I get this warning in the logs -
Triggering Action(1825ded8-a9d9-4884-b22f-054c98621a34+0) for session(appWidget-526) failed
w

Willie Koomson

02/16/2023, 8:20 PM
Can you share what snapshot version you are using? A similar issue was fixed by https://r.android.com/2374748 so its possible you might not have it yet
q

Qusai Zakir

02/16/2023, 8:26 PM
I am using snapshot version: 9591747
w

Willie Koomson

02/16/2023, 8:33 PM
Ah that's from Feb 10, so you should have the fix already...
Can you share a snippet of code that's causing the issue? I can't repro this locally. I killed the widget provider process, then clicked a widget to activate a lambda. The lambda activates after one click, with a short delay
Ah, it also looks like you are generating your own IDs to use for the lambdas instead of the default keys (which should work fine with LazyColumn now). Is it possible the same key is not being used consistently?
If you are generating new keys for your lambdas every time, then a widget created by a previous session cannot activate lambdas in a new session, since they will not match up
q

Qusai Zakir

02/16/2023, 9:16 PM
Good catch! That is exactly what I was doing as the solution for previous issue. I will go back to using the normal lambda and see if that fixes the issue and let you know. Thanks for the help 😀
w

Willie Koomson

02/16/2023, 9:18 PM
Np, hope it works out
20 Views