Search code examples
androidbackground-processbackground-service

background process|service in android studio


I cant find any answers on google cause IDK how to state the problem. I want to know how do you put a background process or function in android which timely do some operations like checking for new notifications, the background process should be working the whole time in any activity, even when application is closed.


Solution

  • You should read this article about Services . But also, you should read about some limitations that there are especially for Android Oreo and above. For example if you have your app closed the OS may kills your Services. Check this link for Background Execution Limits . If you are looking for notifications you should implement a Service that extends MyFirebaseMessagingService and override onMessageReceived method. Please check this link.