Yes; the service still runs in foreground when "Show notifications" is unticked.
Run adb shell dumpsys activity services
and check the value of the isForeground
flag for your service.
* ServiceRecord{e66dea9 u0 com.example.foregroundservice/.ForegroundService}
intent={cmp=com.example.foregroundservice/.ForegroundService}
packageName=com.example.foregroundservice
processName=com.example.foregroundservice:backgroundproc
baseDir=/data/app/com.example.foregroundservice-2/base.apk
dataDir=/data/user/0/com.example.foregroundservice
app=ProcessRecord{254dd51 14363:com.example.foregroundservice:backgroundproc/u0a65}
isForeground=true foregroundId=101 foregroundNoti=Notification(pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE)
createTime=-55s70ms startingBgTimeout=--
lastActivity=-55s70ms restartTime=-55s70ms createdFromFg=true
startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1
Compatibility (using official Android emulators)
Not working:
- 4.0.2 (the "Show notifications" setting isn't available)
Working:
- 4.1.2
- 4.2.2
- 4.3.1
- 4.4.2
- 5.0.2
- 5.1.1
- 6.0
- 7.0
- 7.1