Android Question Starter service and Android 14

_marek

Member
Licensed User
Longtime User
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:
  • 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.
 

DonManfred

Expert
Licensed User
Longtime User
Update B4A
You already use it i saw...

and check this too
 
Upvote 0

_marek

Member
Licensed User
Longtime User
and check this too
That's where I started (my post already links to that). Still no clear answer...
 
Upvote 0

teddybear

Well-Known Member
Licensed User
That's where I started (my post already links to that). Still no clear answer...
Perhaps you should switch to B4XPages, in the post
Erel said that
Another common use case for services was to overcome the activities complex lifecycle. This is not relevant if using B4XPages, where a single activity is used and it is not paused. For non-B4XPages projects, you can continue to use the starter service for such cases. Don't use regular services as they will be killed when the app is in the background.
 
Upvote 0
Top