Hi.
i m using the B4A 8.80 and a Xiaomi Mi A2 Lite (Android 9 P)
when i compile a project, with my screen turned off i got this errors.
In debug.
In release i got error too (no filter logs)
this error occurs even in an empty project in B4A.
if I create an empty project now, without using any libs, and not writing lines of code I get this error when debugging or releasing.
if my screen is on i dont have this error, i got this error only when my screen is off, (turned off with power button)
how can i avoid this error?
on my samsung s7 edge i dont have this error, with android N. and here on xiaomi i got this every time.
it looks a problem with services, the only service in a clean project is the (starter).
how can i try catch this error?
i found anothers questions about this error on the forum, but all questions is related about firebase, and i m not using any lib. only a new b4a project
i found this post on stackoverflow
https://stackoverflow.com/questions...eexception-not-allowed-to-start-service-inten
can i set startForegroundService to starter service?
PS: i dont have error with targetSdkVersion 25-, i got the error using 26
thx
i m using the B4A 8.80 and a Xiaomi Mi A2 Lite (Android 9 P)
when i compile a project, with my screen turned off i got this errors.
In debug.
java.lang.IllegalStateException: Not allowed to start service Intent { cmp=b4a.example/.starter }: app is in background uid UidRecord{3144d32 u0a177 TPSL idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
at android.app.ContextImpl.startService(ContextImpl.java:1532)
at android.content.ContextWrapper.startService(ContextWrapper.java:664)
at anywheresoftware.b4a.keywords.Common$9.run(Common.java:880)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6694)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
In release i got error too (no filter logs)
FATAL EXCEPTION: main
Process: b4a.example, PID: 28460
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example/b4a.example.main}: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=b4a.example/.starter }: app is in background uid UidRecord{4513c26 u0a177 TPSL idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2916)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6694)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=b4a.example/.starter }: app is in background uid UidRecord{4513c26 u0a177 TPSL idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
at android.app.ContextImpl.startService(ContextImpl.java:1532)
at android.content.ContextWrapper.startService(ContextWrapper.java:664)
at anywheresoftware.b4a.keywords.Common.StartService(Common.java:894)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.startFromActivity(ServiceHelper.java:184)
at b4a.example.main.onCreate(main.java:64)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2896)
... 11 more
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example/b4a.example.main}: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=b4a.example/.starter }: app is in background uid UidRecord{4513c26 u0a177 TPSL idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2916)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6694)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=b4a.example/.starter }: app is in background uid UidRecord{4513c26 u0a177 TPSL idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
at android.app.ContextImpl.startService(ContextImpl.java:1532)
at android.content.ContextWrapper.startService(ContextWrapper.java:664)
at anywheresoftware.b4a.keywords.Common.StartService(Common.java:894)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.startFromActivity(ServiceHelper.java:184)
at b4a.example.main.onCreate(main.java:64)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2896)
... 11 more
Force finishing activity b4a.example/.main
Sending signal. PID: 28460 SIG: 9
this error occurs even in an empty project in B4A.
if I create an empty project now, without using any libs, and not writing lines of code I get this error when debugging or releasing.
if my screen is on i dont have this error, i got this error only when my screen is off, (turned off with power button)
how can i avoid this error?
on my samsung s7 edge i dont have this error, with android N. and here on xiaomi i got this every time.
it looks a problem with services, the only service in a clean project is the (starter).
how can i try catch this error?
i found anothers questions about this error on the forum, but all questions is related about firebase, and i m not using any lib. only a new b4a project
i found this post on stackoverflow
https://stackoverflow.com/questions...eexception-not-allowed-to-start-service-inten
but is the starter service, i dont have control of this.It means that you cannot start a service when your app is in the background
can i set startForegroundService to starter service?
PS: i dont have error with targetSdkVersion 25-, i got the error using 26
thx
Last edited: