To declare your service, you need to add its class to the Android Manifest. The following code snippet explains what the service definition in Android Manifest should look like:
<manifest xmlns:android= "http://schemas.android.com/apk/res/android" package="com.journaler"> ... <application ... > <service android:name=".service.MainService" android:exported="false" /> ... </application> </manifest>
As you can see, we defined the MainService class that extends the Service class and it's located under the service package. The exported flag is set to false, which means that the service will run in the same process as our application. To run your service in a separate process, set this flag to true.
It's important to ...