Hello guys,
In my app I use Starter service to communicate with external devices like Bluetooth, USB, TCP.
I got reports that on some devices running Android 14 app stops communication when in background after minute or so.
I am confused of how to handle Starter service in Android 14 and I am unable to find definitive answer. I am aware that Android 14 requires foreground services to define services types.
Based on this old post, Starter should not be made foreground. Until now I sticked to that. However, based on some newer posts (ex1, ex2), it seems that developers are making it foreground and defining a type for it.
My question is, should Starter be made foreground when targeting Android 14, further implying that a type shall be specified for it?
My project:
I am unable to post any logs since I am not able to replicate the problem on my Android 14 devices.
In my app I use Starter service to communicate with external devices like Bluetooth, USB, TCP.
I got reports that on some devices running Android 14 app stops communication when in background after minute or so.
I am confused of how to handle Starter service in Android 14 and I am unable to find definitive answer. I am aware that Android 14 requires foreground services to define services types.
Based on this old post, Starter should not be made foreground. Until now I sticked to that. However, based on some newer posts (ex1, ex2), it seems that developers are making it foreground and defining a type for it.
My question is, should Starter be made foreground when targeting Android 14, further implying that a type shall be specified for it?
My project:
- is Non-B4XPages project
- I use B4A v13.0 [beta]
- I stop automatic foreground state in Starter:
B4X:
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground
End Sub
- Manifest
B4X:
<uses-sdk android:minSdkVersion="16" android:compileSdkVersion="33" android:targetSdkVersion="34"/>
I am unable to post any logs since I am not able to replicate the problem on my Android 14 devices.