Background start not allowed

Hi Everyone,
I’m integrating the Fling SDK for both controller and receiver sides for my media player application. When the TV application is in the background (after a force stop) and I start casting from mobile, I’m getting the following error:

Background start not allowed: service Intent { flg=0x10000000 cmp=my.package.name/my.package.fling.FlingPlayerService } to my.package.name/my.package.fling.FlingPlayerService from pid=16210 uid=10058 pkg=com.amazon.whisperlink.core.android startFg?=false

I’ve added these permissions to my manifest for TV:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

And also this:

    <service
        android:name=".fling.FlingPlayerService"
        android:exported="true"
        android:foregroundServiceType="mediaPlayback" />

    <meta-data
        android:name="whisperplay"
        android:resource="@xml/whisperplay" />`

Also, I’m starting the FlingPlayerService as a foregroundService, but even the onCreate and onStartCommand are not getting called. This issue is happening under the hood and I don’t know what else I could do about it. When the TV app is opened and closed (but I assume is still in the memory), it gets opened when I’m starting the casting.

Please help :pray:

Hi Peter,

Welcome to the Forums, and thank you for posting! Could you please specify the device model and OS versions on both your TV and mobile device? Thanks!

Hi Levon, thanks for getting back to me.

Firestick details:

  • Fire TV Stick Lite
  • Fire OS 7.6.8.1 (PS7681/4391)
  • Home version: 6540146.1

Mobile details:

  • Samsung Galaxy S21 Ultra 5G
  • Android version: 14

I have run into similar issues with my app, so I tried using the sample apps in the SDK and got similar results. I cannot fling to the sample custom player app when it is in the background because of the “Abort background activity starts from…” error. When the app is already running it seems to work just fine.