Android Question Not allowed to start service Intent ... app is in background

scsjc

Well-Known Member
Licensed User
Longtime User
i receive this error, when receive intent:

B4X:
Fatal Exception: java.lang.RuntimeException
Unable to start receiver myworldapp.radiofm.com.a2dp$a2dp_BR: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=myworldapp.radiofm.com/.a2dp (has extras) }: app is in background uid UidRecord{fcd9777 u0a216 RCVR bg:+2m1s629ms idle procs:1 seq(4465,4465,4465)}
android.app.ActivityThread.handleReceiver (ActivityThread.java:3397)
android.app.ActivityThread.-wrap18 (Unknown Source)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
android.os.Handler.dispatchMessage (Handler.java:105)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6938)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)


Caused by java.lang.IllegalStateException
Not allowed to start service Intent { cmp=myworldapp.radiofm.com/.a2dp (has extras) }: app is in background uid UidRecord{fcd9777 u0a216 RCVR bg:+2m1s629ms idle procs:1 seq(4465,4465,4465)}
android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)
android.app.ContextImpl.startService (ContextImpl.java:1484)
android.content.ContextWrapper.startService (ContextWrapper.java:663)
android.content.ContextWrapper.startService (ContextWrapper.java:663)
anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.startServiceFromReceiver (ServiceHelper.java:125)
myworldapp.radiofm.com.a2dp$a2dp_BR.onReceive (a2dp.java:17)
android.app.ActivityThread.handleReceiver (ActivityThread.java:3390)
android.app.ActivityThread.-wrap18 (Unknown Source)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
android.os.Handler.dispatchMessage (Handler.java:105)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6938)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

in screen from crashlytics:
upload_2018-11-14_21-29-23.png


i see error line on a2dp service at line java:17...

upload_2018-11-14_21-30-44.png



some idea where are error?
 

scsjc

Well-Known Member
Licensed User
Longtime User
1. i launch by intent:
B4X:
AddReceiverText(a2dp, <intent-filter android:priority="2147483647">
    <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
    <action android:name="android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED" />
    <action android:name="android.intent.action.PHONE_STATE" />
    <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>)

2. the version of B4A is 8.50
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
Are you able to reproduce it?

For some reason the framework indicates that one of the activities is visible while the app is actually in the background. I cannot say what causes it. Are you doing anything special with the activities?

I'm not capable, it's a mistake that happens and I do not know at what point (only very occasionally)

I'm not doing anything special, actually the activity may even die and the service continues to play audio through exoplayer
 
Upvote 0
Top