Android Question Notification bar and foreground service

Semen Matusovskiy

Well-Known Member
Licensed User
To workaround Oreo's limitations, I decided to add a line
If SdkVersion >= 26 Then Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS

To my surprise I noticed additional icon in status bar and a dummy notification from my app in notification bar.
If to remove a line, which I added to service, dummy notification and icon in status bar will disappear.

So, I completely sure that dummy notification is a side effect of Service.AUTOMATIC_FOREGROUND_ALWAYS.
Is it possible to avoid similar effect ?
 

Semen Matusovskiy

Well-Known Member
Licensed User
This is not needed. The default mode is enough to properly start services in the background.

Erel --

Do you want to say that FLP (and first of all GPS) will work normally in background, unlike https://developer.android.com/about/versions/oreo/background-location-limits talks

Affected APIs
Fused Location Provider (FLP)
  • If your app is running in the background, the location system service computes a new location for your app only a few times each hour. This is the case even when your app is requesting more frequent location updates.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
In my first post l told about Oreo+ (SDK 26+). I know that it,'s possible to replace dummy notification. But is it possible to remove the notification at all?
 
Upvote 0
Top