Defining the intent service

We have our main service running and responsibility defined. We will now make more improvements to our application by introducing one more service. This time, we will define the intent service. The intent service will take over the responsibility for the execution of the database CRUD operations. Basically, we will define our intent service and perform refactoring of the code we already have.

First, we will create a new class inside the service package called DatabaseService. Before we put the whole implementation, we will register it in the Android Manifest as follows:

    <manifest xmlns:android= "http://schemas.android.com/apk/res/android" package="com.journaler"> ... <application ... > <service android:name=".service.MainService" ...

Get Mastering Android Development with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.