Oreo Background Services

不打扰是莪最后的温柔 提交于 2019-12-06 08:06:16

But we saw that when the application is killed, the Foreground Service dies also after a few minutes. Should it happen? Should the Foreground Service will only continue to work if the app is in the background?

Yes it destroys foreground service.., But it recreates again within the microseconds... Its natural behaviour. Even if you killed app by swiping it away from recent apps..!!

Post your foreground service code only..!! with no extra code and i will correct it so that it can behave the way i stated..

Also, if this is the case what does the Battery Optimization feature do? Keeps the Service working while in background only? Can the Service still be killed while the app is the background with this feature on?

If battery is optimising then it might not re launch your foreground service too ON_BOOT_COMPLETE

I've read a lot of docs regarding it but I'm still confused regarding the state of Service when the application is killed.

Yes, i know it is total waste of time as google documentation is having no straight forward ways in documenting and there are no sample codes for developers... If you wants to code for more than 4 android os then all codes needed to coded as per version codes..!!

We do not mind showing a notification for those services but we still want it to continue to work "endlessly".

It never happens... ENDLESSLY must be implemented with the broadcastreceivers as and and when you wants your services can seem to be running endlessly.. Again you can not create static receivers and can not call them via manifest as before... You need to create it from a foreground service in runtime.

Where i can get example codes? No where... Google has no sample codes... just blah blah blah...

Short and sweet... I had lost my complete year and now well known about all above your questions and have implemented it in apps and apps are in market running quite good as expected... And i like to help them all as google lacks it in documentation.. Post your code , Let me know, and Get it worked from me


Edit : 2

Google has made wrong os ( Android ) based on wrong concept with wrong implementation with wrong support with wrong documentation with wrong License which is open source which allows non - standard companies to modify and use it.. Now Consider its dis-advantages :

  1. It frustrates developers to code an app which even supports for more than one version.. Say Lollipop and Marshmallow. Both ways are different and already developer has 1000 cases to handle and then again this..
  2. Case becomes worst to develop when it comes to develop more than 2 versions at a time... Its a complete mess..
  3. Again google keep changing rules over few months of time...
  4. With no proper documentation makes developers only one option open is to pull the hairs out..!!
  5. These all was not sufficient ..., so again :-

Vivo : ColorOs OnePlus : OxygenOs MI : FunTouchOs . . . .

This is huge list of companies who does not know how to modify ( and why to modify...? ) started modifying stock-android.., most of which only allows facebook, Google, Whatsapp, Instagram, major social app vendors services only to come in memory on Boot_complete.

Why only these services and why not mine..?

Because buyers wont buy a phone on which above softwares will not work..!! No one will take such phones..!!

Why not mine..?

This is a business

Is there any other way...?

No way..!! As we develop apps standardly on Googles Android Studio and also tests it on emulators of google which holds stock-android systems..!! So don't guranty will it work on every manufacturers device or not..!!

Who is responsible for these all situations.. and what is solution..?

Google is responsible for these all frustrations and all the mobile phone manufactures has taken it the such extent which is now impossible to handle.. Google has to come with restriction on modifications and also hardware support systems must be implemented..!! Best way to dis-continue such unmanaged operating system.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!