Android Question How detect which service show notification

Pooya1

Active Member
Licensed User
Hi
I have 5 service in my app that i stop their when my job finished
Also write many code in Starter service
Unfortunately android show notification for my app in notification bar and i dont know which service is the reason
I use below code after finished my job in service
B4X:
Sleep(0)
StopService(Me)
Service.StopAutomaticForeground
I am sure starter service is not reason or problem because when i disable notification,Starter is working well
But i dont know which
My attachment picture
photo_2018-11-04_15-30-42.jpg
In this picture when i disable sound,so my app notification dont appear in notification bar
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Services only enter automatic foreground mode when they are started from a receiver while the app is in the background.

You can disable foreground mode in all your services with this line in Service_Create of each of the services:
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER

This will cause the app to crash if won't start foreground mode when needed yourself (on Android 8+). However it will help you find out what happens.
 
Upvote 0
Top