Notes: 22. Conclusion
The student materials have been reviewed and are updated as of SEPTEMBER 2022.
Awesome to see you at the end of the third part of this course! :] Well done! You’ve learned a lot, but there’s always more.
In this part of the course, you learned about different types of services. Services are used to run code in parallel with the rest of the app, and they usually represent a long running operation, like playing music, or deleting files.
There are categories each service can be a part of. You learned about foreground and background services, which are different only by the fact that the user knows about foreground services visually, and doesn’t know about background services at all. You also learned about bound and unbound services.
You learned services can extend three different classes - the Service, IntentService, and JobIntentService classes to be exact. The base Service is when you want a service which runs as long as you don’t stop it, and receives commands over time.
The other two are used when you have one-off work, that you need to run in the background. The difference between them is that IntentService is deprecated, and JobIntentService determines if it can use an IntentService, or a Job from the JobScheduler API.
As of Android Oreo, apps are very limited in what they can work on while in the background. In fact, apps can only receive a small set of messages and brodcasts when they are backgrounded.
So your services have to use a foreground notification, if you want to work with them, even if your app is not being used.
And to finish off with services, you used BroadcastReceivers, a special component of Android, used to receive broadcasts, and notify the UI of such events. Specifically, you used receivers to notify the user that an operation is finished, using a Toast.
This has been a really exciting part! You’re now able to implement many different ways to process data in the background.
In the final part of the course, we’ll pay tribute to some legacy concepts of background processing in Android! See you there! :]