I have fixed the problem with starting the service with startService(intent)
instead of Context.startForeground()
and calling startForegound()
immediately after super.OnCreate()
. Additionally, if you starting service on boot, you can start Activity that starts service on the boot broadcast. Although it is not a permanent solution, it works.