Android Question FireBase RuntimeException

ilan

Expert
Licensed User
Longtime User
hi

i am getting lately some crash reports in my console on android 8 in my firebase service.
i have followed the tutorial (how serviced are working in android 8) and also the firebase tutorial but still get those crashes. the weird thing is that i am not sending any push messages to the devices so it happens i guess on app start where i initialize firebase or something like that.

any ideas why i am getting it?

java.lang.RuntimeException:

at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3694)

at android.app.ActivityThread.-wrap21 (Unknown Source)

at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1801)

at android.os.Handler.dispatchMessage (Handler.java:105)

at android.os.Looper.loop (Looper.java:164)

at android.app.ActivityThread.main (ActivityThread.java:6938)

at java.lang.reflect.Method.invoke (Native Method)

at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException:

at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)

at android.app.ContextImpl.startService (ContextImpl.java:1484)

at android.content.ContextWrapper.startService (ContextWrapper.java:663)

at anywheresoftware.b4a.keywords.Common.StartService (Common.java:884)

at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand (ServiceHelper.java:211)

at www.sagital.mysalarynew.firebasemessaging.onStartCommand (firebasemessaging.java:69)

at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3677)
 

ilan

Expert
Licensed User
Longtime User
1. Are you using B4A v8?

2. Are you starting the starter service yourself?

1, yes i am using b4a 8

2, in starter service create i have this:

B4X:
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'notification test
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Have you set FirebaseMessaging service to be a sticky service? Is there any service that start at boot?

hi erel,

no, i have not set the FireBaseService to as sticky service. as i remember correctly it is not set to a sticky service in the tutorial too. should it be a sticky service?

i have 2 services running, the starter service and the firebaseservice.
i think the starter service starts on boot (i just have not my pc infront of me.)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
ok then sorry, it is set to false because i have not change anything, i left it as B4A created the Project. So if B4A is creating it with FALSE then it is set to FALSE.

i just saw another crash report.

java.lang.RuntimeException:

at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3694)

at android.app.ActivityThread.-wrap21 (Unknown Source)

at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1801)

at android.os.Handler.dispatchMessage (Handler.java:105)

at android.os.Looper.loop (Looper.java:164)

at android.app.ActivityThread.main (ActivityThread.java:6938)

at java.lang.reflect.Method.invoke (Native Method)

at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)

at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException:

at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)

at android.app.ContextImpl.startService (ContextImpl.java:1484)

at android.content.ContextWrapper.startService (ContextWrapper.java:663)

at anywheresoftware.b4a.keywords.Common.StartService (Common.java:884)

at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand (ServiceHelper.java:211)

at www.sagital.mysalarynew.firebasemessaging.onStartCommand (firebasemessaging.java:69)

at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3677)

this is 100% created with b4a 8 because i see the version of the App and it is a new version.

this is how it looks like:

crash.jpg
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Are you using a custom implementation of StartServiceAt, similar to this one: https://www.b4x.com/android/forum/t...estartatexact-not-accurate.65117/#post-412286 ?

no.

i just receive another crash report from firebase (i have not sent any notifications since last week)

maybe it gives more informations:

Exception java.lang.RuntimeException: Unable to start service www.sagital.mysalarynew.firebasemessaging@d6999e4 with null: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=www.sagital.mysalarynew/.starter }: app is in background uid UidRecord{a881730 u0a108 SVC idle procs:1 seq(0,0,0)}
android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3721)
android.app.ActivityThread.-wrap20 ()
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1793)
android.os.Handler.dispatchMessage (Handler.java:105)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6809)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
arrow_drop_down
Caused by java.lang.IllegalStateException: Not allowed to start service Intent { cmp=www.sagital.mysalarynew/.starter }: app is in background uid UidRecord{a881730 u0a108 SVC idle procs:1 seq(0,0,0)}
android.app.ContextImpl.startServiceCommon (ContextImpl.java:1522)
android.app.ContextImpl.startService (ContextImpl.java:1478)
android.content.ContextWrapper.startService (ContextWrapper.java:645)
anywheresoftware.b4a.keywords.Common.StartService (Common.java:884)
anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand (ServiceHelper.java:211)
www.sagital.mysalarynew.firebasemessaging.onStartCommand (firebasemessaging.java:69)
android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3704)
android.app.ActivityThread.-wrap20 ()
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1793)
android.os.Handler.dispatchMessage (Handler.java:105)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6809)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)

EDIT: it says app is in background, not allowed to start service ???
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
You can also add Sleep(10000) before starting FirebaseMessaging from the starter service.

Ok when i get to my pc i will look at it closer.

The only thing that should start the service is a notification or the starter service.

If the app is in background and a notification arrives the service should start right? Even if app is in background.

Does it first start the starter service or only the firebaseservice? (I mean a notification)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If the app is in background and a notification arrives the service should start right? Even if app is in background.
Yes.

Does it first start the starter service or only the firebaseservice? (I mean a notification)
The starter service will be started when the process is started.

A possible cause of this error is the usage of an old FirebaseNotifications.jar. Open the internal libraries folder and check the size of FirebaseNotifications.jar. It should be 9506 bytes.
 
Upvote 0
Top