Starting the service

To start the service, we need to define the intent that will represent it. This is an example on how the service can be started:

    val startServiceIntent = Intent(ctx, MainService::class.java) 
    ctx.startService(startServiceIntent) 

Here, ctx represents any valid instance of the Android Context class.