asales Expert Licensed User Longtime User Dec 23, 2024 #1 I get this error in Firebase Crashlytics, in some types of devices, like Itel A60, Tecno POP 7, TCL 10 SE: Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{c020b05 u0 br.com.apps.profileapp/.firebasemessaging} Is a B4XPages app and I use the original code from Firebase Push Notifications 2023+. I check this thread Automatic Foreground Mode and it uses this code to Service_Start: B4X: Sub Service_Start (StartingIntent As Intent) fm.HandleIntent(StartingIntent) Sleep(0) 'allow the MessageReceived event to be raised. Service.StopAutomaticForeground End Sub Can I use the same approach ("new code") to Receiver_Receive? Could be a soluction? B4X: Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent) 'original code If FirstTime Then fm.Initialize("fm") End If fm.HandleIntent(StartingIntent) 'new code Sleep(0) Service.StopAutomaticForeground End Sub Thanks in advance for any tips.
I get this error in Firebase Crashlytics, in some types of devices, like Itel A60, Tecno POP 7, TCL 10 SE: Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{c020b05 u0 br.com.apps.profileapp/.firebasemessaging} Is a B4XPages app and I use the original code from Firebase Push Notifications 2023+. I check this thread Automatic Foreground Mode and it uses this code to Service_Start: B4X: Sub Service_Start (StartingIntent As Intent) fm.HandleIntent(StartingIntent) Sleep(0) 'allow the MessageReceived event to be raised. Service.StopAutomaticForeground End Sub Can I use the same approach ("new code") to Receiver_Receive? Could be a soluction? B4X: Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent) 'original code If FirstTime Then fm.Initialize("fm") End If fm.HandleIntent(StartingIntent) 'new code Sleep(0) Service.StopAutomaticForeground End Sub Thanks in advance for any tips.
Erel B4X founder Staff member Licensed User Longtime User Dec 24, 2024 #2 FirebaseMessaging should be a receiver, not a service: https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/#content Upvote 0
FirebaseMessaging should be a receiver, not a service: https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/#content
asales Expert Licensed User Longtime User Dec 24, 2024 #3 Erel said: FirebaseMessaging should be a receiver, not a service: https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/#content Click to expand... The FirebaseMessaging in all my apps are a receiver (based in this example) and I get the error message in Crashlytics. I just want to know If I use this code in receiver could solved the problem? B4X: Sleep(0) Service.StopAutomaticForeground Upvote 0
Erel said: FirebaseMessaging should be a receiver, not a service: https://www.b4x.com/android/forum/threads/b4x-firebase-push-notifications-2023.148715/#content Click to expand... The FirebaseMessaging in all my apps are a receiver (based in this example) and I get the error message in Crashlytics. I just want to know If I use this code in receiver could solved the problem? B4X: Sleep(0) Service.StopAutomaticForeground
Erel B4X founder Staff member Licensed User Longtime User Dec 25, 2024 #4 No. Is this the full error message? If not please post it. Upvote 0
asales Expert Licensed User Longtime User Dec 25, 2024 #5 Erel said: Is this the full error message? If not please post it. Click to expand... Here the full error message to 2 apps that uses the FirebaseMessaging receiver. As I said, this is happens in some types of devices: Tecno POP 7, Itel S18, Itel A60, Camon 19, Nokia 6.2. Spoiler: Error app 1 B4X: Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{6b7980c u0 br.com.apps.profileapp/.firebasemessaging} at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2006) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7701) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952) Spoiler: Error app 2 B4X: Fatal Exception: android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d880e58 u0 br.com.apps.stickerapp/.firebasemessaging} at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1989) at android.app.ActivityThread.access$2700(ActivityThread.java:272) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7981) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:553) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Upvote 0
Erel said: Is this the full error message? If not please post it. Click to expand... Here the full error message to 2 apps that uses the FirebaseMessaging receiver. As I said, this is happens in some types of devices: Tecno POP 7, Itel S18, Itel A60, Camon 19, Nokia 6.2. Spoiler: Error app 1 B4X: Fatal Exception: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{6b7980c u0 br.com.apps.profileapp/.firebasemessaging} at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2006) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7701) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952) Spoiler: Error app 2 B4X: Fatal Exception: android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d880e58 u0 br.com.apps.stickerapp/.firebasemessaging} at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1989) at android.app.ActivityThread.access$2700(ActivityThread.java:272) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7981) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:553) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Erel B4X founder Staff member Licensed User Longtime User Dec 26, 2024 #6 It looks like they are running an older version of your app where firebasemessaging is still a service. Upvote 0
It looks like they are running an older version of your app where firebasemessaging is still a service.