Hi, does anybody know how to trigger a <https://de...
# android
j
not kotlin but kotlin colored 1
k
interesting one i just got this issue coming up from my app. https://github.com/Nailik/rhasspy_mobile/issues/503
j
Unfortunately I am not able to reproduce this exception. Does somebody know how to do it?
@Kilian Do you start your service too early so that there is no activity presented to the user? Maybe thats also my issue?
An assumption might be that your app is still considered to be in background mode because you start your service in Application.kt and therefore it does not have an active/visible activity, see https://developer.android.com/about/versions/oreo/background#services
And maybe thats also the case for my problem. Right now I always tested the other way around. Delayed the start of the service after an activity was created ...
k
yep i think it starts in the application before the app is considered to be in foreground. But maybe it’s because i use the service context to start the foreground service. I do Application Start -> Service Start -> Service starts itself and shows notification. I do this because previously i had Application Start -> Start Service as Foreground -> Show notification in on create of service. However the app has only 5 seconds to show the notification else it’s force killed by the system and sometimes the delay was too big therefore i changed it.