I'm using this technique so that I can show a Comp...
# compose-android
c
I'm using this technique so that I can show a Composable from a foreground service. Similar to how you would implement chat bubbles or similar floating UI. https://stackoverflow.com/questions/76868989/floating-window-over-apps-in-jetpack-compose-foreground-service/78102901#78102901 It seems to work fine except that I can't my composable doesn't recompose when I update some mutableState that's passed to it. Does anyone know if that's a limitation of using Compose in a foregroundService overlay?
j
Are you running it from the same process as your main UI?
👌 1
Sounds like you don't have a coroutine which is observing the snapshot change and applying it
👍 1
c
thanks will give that a shot ❤️
j
Compose UI will do this for you, normally, but it might be contingent on you showing it within an activity first to kickstart the coroutine
☝️ 1
I don't remember where it launches this
z
Compose ui should always bootstrap snapshot observation. If it’s not, that’s a bug.
j
Yeah there's a singleton somewhere
☝🏻 1
c
Hm. so maybe a minimal repro would be worth filing?
z
Yes please
1
z
Were you able to create a repro? Ive been using a similar approach for years and it has worked flawlessly. Might be some minor differences though: • I use LifecycleService and collect my flows (that update mutableState) inside its lifecycleScope.launch. • I have a class that extends AbstractComposeView with mutableState properties inside it. • I use createDisplayContext and createWindowContext for the context that the ComposeView uses (logcat complains otherwise). I dont know if any of these do anything in terms of compose 🤷🏽‍♂️
c
I've got a repro yeah. but its in my project. so i just need to consolidate it and post to issuetracker. lol
🎉 1