S skaliwag Member Licensed User Longtime User Sep 17, 2024 #1 The Developer Concole gives this as an issue that needs attention :- Missing foreground service type From Android 14, developers must specify service types when foreground services are found in their app's manifest. A version of your app that is currently in production is crashing because it tries to start a foreground service when no foreground service type is declared. Make sure that service types for the services that start in the foreground are specified in your app's manifest. The stack for the crash shows this Exception java.lang.RuntimeException: at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5286) at android.app.ActivityThread.-$$Nest$mhandleServiceArgs at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2531) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loopOnce (Looper.java:230) at android.os.Looper.loop (Looper.java:319) at android.app.ActivityThread.main (ActivityThread.java:8919) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103) Caused by java.lang.RuntimeException: at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:173) at uk.co.stefsquared.vanguard.starter.handleStart (starter.java:102) at uk.co.stefsquared.vanguard.starter.access$000 (starter.java:8) at uk.co.stefsquared.vanguard.starter$1.run (starter.java:74) at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand (ServiceHelper.java:240) at uk.co.stefsquared.vanguard.starter.onStartCommand (starter.java:72) at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5268) Caused by android.app.MissingForegroundServiceTypeException: at android.app.MissingForegroundServiceTypeException$1.createFromParcel (MissingForegroundServiceTypeException.java:53) at android.app.MissingForegroundServiceTypeException$1.createFromParcel (MissingForegroundServiceTypeException.java:49) at android.os.Parcel.readParcelableInternal (Parcel.java:4882) at android.os.Parcel.readParcelable (Parcel.java:4864) at android.os.Parcel.createExceptionOrNull (Parcel.java:3064) at android.os.Parcel.createException (Parcel.java:3053) at android.os.Parcel.readException (Parcel.java:3036) at android.os.Parcel.readException (Parcel.java:2978) at android.app.IActivityManager$Stub$Proxy.setServiceForeground (IActivityManager.java:7234) at android.app.Service.startForeground (Service.java:775) at anywheresoftware.b4a.objects.ServiceHelper.StartForeground (ServiceHelper.java:85) at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:171) This is a B4A project built with Version 13 targeting SDK 34 I have Service.StopAutomaticForeground in the Service_Start Sub of Starter As is so often the case, I am unable to duplicate the error Any help much appreciated Last edited: Sep 17, 2024
The Developer Concole gives this as an issue that needs attention :- Missing foreground service type From Android 14, developers must specify service types when foreground services are found in their app's manifest. A version of your app that is currently in production is crashing because it tries to start a foreground service when no foreground service type is declared. Make sure that service types for the services that start in the foreground are specified in your app's manifest. The stack for the crash shows this Exception java.lang.RuntimeException: at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5286) at android.app.ActivityThread.-$$Nest$mhandleServiceArgs at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2531) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loopOnce (Looper.java:230) at android.os.Looper.loop (Looper.java:319) at android.app.ActivityThread.main (ActivityThread.java:8919) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103) Caused by java.lang.RuntimeException: at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:173) at uk.co.stefsquared.vanguard.starter.handleStart (starter.java:102) at uk.co.stefsquared.vanguard.starter.access$000 (starter.java:8) at uk.co.stefsquared.vanguard.starter$1.run (starter.java:74) at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand (ServiceHelper.java:240) at uk.co.stefsquared.vanguard.starter.onStartCommand (starter.java:72) at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5268) Caused by android.app.MissingForegroundServiceTypeException: at android.app.MissingForegroundServiceTypeException$1.createFromParcel (MissingForegroundServiceTypeException.java:53) at android.app.MissingForegroundServiceTypeException$1.createFromParcel (MissingForegroundServiceTypeException.java:49) at android.os.Parcel.readParcelableInternal (Parcel.java:4882) at android.os.Parcel.readParcelable (Parcel.java:4864) at android.os.Parcel.createExceptionOrNull (Parcel.java:3064) at android.os.Parcel.createException (Parcel.java:3053) at android.os.Parcel.readException (Parcel.java:3036) at android.os.Parcel.readException (Parcel.java:2978) at android.app.IActivityManager$Stub$Proxy.setServiceForeground (IActivityManager.java:7234) at android.app.Service.startForeground (Service.java:775) at anywheresoftware.b4a.objects.ServiceHelper.StartForeground (ServiceHelper.java:85) at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent (ServiceHelper.java:171) This is a B4A project built with Version 13 targeting SDK 34 I have Service.StopAutomaticForeground in the Service_Start Sub of Starter As is so often the case, I am unable to duplicate the error Any help much appreciated
agraham Expert Licensed User Longtime User Oct 3, 2024 #21 I take it from @drgottjr info above then, that the manifest for the failing app does not include a foregroundservice type declaration and hence the MissingForegroundServiceTypeException is being correctly thrown. The question then is how the code execution path gets to that point for a few users but not, apparently, the many? Back to Erel! Last edited: Oct 3, 2024 Upvote 0
I take it from @drgottjr info above then, that the manifest for the failing app does not include a foregroundservice type declaration and hence the MissingForegroundServiceTypeException is being correctly thrown. The question then is how the code execution path gets to that point for a few users but not, apparently, the many? Back to Erel!
Robert Valentino Well-Known Member Licensed User Longtime User Oct 3, 2024 #22 Or is there a way to define the Starter service in the manifest? This was the reason I posted this https://www.b4x.com/android/forum/threads/short-service-specialuse.163399/#post-1002304 Upvote 0
Or is there a way to define the Starter service in the manifest? This was the reason I posted this https://www.b4x.com/android/forum/threads/short-service-specialuse.163399/#post-1002304
agraham Expert Licensed User Longtime User Oct 3, 2024 #23 Robert Valentino said: Or is there a way to define the Starter service in the manifest? Click to expand... Your post links to it but I don't know what foreground service type would work and be acceptable in the PlayStore. What puzzles me is that it seems that only a few users execute the code path that leads to the exception being thrown which is why I would like Erel to weigh in on this. Upvote 0
Robert Valentino said: Or is there a way to define the Starter service in the manifest? Click to expand... Your post links to it but I don't know what foreground service type would work and be acceptable in the PlayStore. What puzzles me is that it seems that only a few users execute the code path that leads to the exception being thrown which is why I would like Erel to weigh in on this.
S skaliwag Member Licensed User Longtime User Oct 9, 2024 #24 skaliwag said: There are no other services in the project. I am not calling StartService anywhere. I have added the suggested modification to Service_Create, and will report back when I have more Analytics data. Click to expand... Since adding this, I am getting no reports of the original error. Normally, in Developer Console, I have the "User-perceived crashes and ANRs" filter enabled. If I turn this off it is still showing a Starter Service crash in the onCreate method of various activities which seem to be caused by this code:- Code: if (anywheresoftware.b4a.objects.ServiceHelper.StarterHelper.startFromActivity(this, processBA, wl, false)) BA.handler.postDelayed(wl, 5); Note that this error occurs very rarely As the user doesn't see this, it is not a priority, but it may explain why other developers are getting crash reports, but their users are not reporting crashes. Last edited: Oct 10, 2024 Upvote 0
skaliwag said: There are no other services in the project. I am not calling StartService anywhere. I have added the suggested modification to Service_Create, and will report back when I have more Analytics data. Click to expand... Since adding this, I am getting no reports of the original error. Normally, in Developer Console, I have the "User-perceived crashes and ANRs" filter enabled. If I turn this off it is still showing a Starter Service crash in the onCreate method of various activities which seem to be caused by this code:- Code: if (anywheresoftware.b4a.objects.ServiceHelper.StarterHelper.startFromActivity(this, processBA, wl, false)) BA.handler.postDelayed(wl, 5); Note that this error occurs very rarely As the user doesn't see this, it is not a priority, but it may explain why other developers are getting crash reports, but their users are not reporting crashes.
peacemaker Expert Licensed User Longtime User Oct 27, 2024 #25 No solution yet ? Also touched. Upvote 0