Android Question android.app.MissingForegroundServiceTypeException

Pathrose

Member
Licensed User
Hi, Referring to my previous question above, after lot of research, I think I found the issue ...

Though my manifest editor did not show any line related to foreground service, I checked the compiled manifest.xml file inside the Objects folder and found this line: <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

I understand that this line in the compiled manifest file is making the playstore throw exception. Even though neither did my manifest editor contain anything related to foreground service nor did my starter service contain any code, simply having the Starter service declared in the project caused B4A to add the foreground service permission automatically..

Solution.. I removed the Starter service module from the project as it does not contain any code, and after recompiling, the manifest.xml no longer included the FOREGROUND_SERVICE permission. The Play Console has not shown any crash so far..

I dont know whether this is the right approach, however this error is likely to be faced by many in the latest version of android in some phones..
 

giggetto71

Active Member
Licensed User
Longtime User
is there any update on this? unfrotunately in my case I cannot remove the starter service..so @Erel please let us know when you find (and I am sure you will) the root cause. thanks!
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
is there any update on this? unfrotunately in my case I cannot remove the starter service..so @Erel please let us know when you find (and I am sure you will) the root cause. thanks!
have you tried: RemovePermission(android.permission.FOREGROUND_SERVICE) in the manifest editor?
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
no I did not as my app actually needs to run a foreground service so I have

AddPermission(android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE) '1.6.7
AddPermission(android.permission.CHANGE_NETWORK_STATE) '1.6.7
SetServiceAttribute(MQTTService, android:foregroundServiceType, "connectedDevice")
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I have this message about Starter service in Firebase Crashlytics:
android.app.MissingForegroundServiceTypeException: Starting FGS without a type
and was solved with this line in manifest:
B4X:
SetServiceAttribute(Starter, android:foregroundServiceType, shortService)
from this post:
 
Upvote 0
Top