community
community copied to clipboard
A way to input foreground service type
After using the code in the Wiki to start a foreground service properly
In the service file I keep getting this error
jnius.jnius.JavaException: JVM exception occurred: Starting FGS without a type callerApp=ProcessRecord{fc07cfb 7444:org.laner.lan_ft:service_Final/u0a305} targetSDK=35 android.app.MissingForegroundServiceTypeException
After reading through this stack answer for kotlin I understand it needs the service type to specify the service element in the XML from android 13+
It'll be great to have a way to specify the service type
Let me know if this solves your problem: https://github.com/Android-for-Python/Android-for-Python-Users?tab=readme-ov-file#android-service
Thank you @ElliotGarbus I've learnt a whole lot for the section you provided it said I need to specify foreground:sticky to let the service run regardless of the app open state and that it's running as a service regardless of the notification.
But I tried specifying foreground:sticky only and it didn't work my service lifetime still lasts for roughly 1 minute
Also compiled the music player example and it threw the same error I was getting when I tried starting the service notification
I'd recommend asking about this issue on the kivy discord.