1

I have two modules: base application module, and install-time dynamic feature module. DFM contains a service. Service is declared in DFM manifest, and I check the DFM to be deployed in Android Studio's run configuration.

How do I start a DFM service from base module activity?

My current code is:

// base module
// package com.example.myapp
// MainActivity.kt

 protected fun startMyService() {
        Intent().apply {
            setClassName(
                "com.example.myapp.installed",
                "com.example.myapp.installed.MyService"
            )
        }.also {
            ContextCompat.startForegroundService(this, it)
        }
    }

But when I call this, nothing happens.

Just for information, if I move the service to the base module (and correct the package and class names in the code above), the service starts properly.

Nu-hin
  • 691
  • 1
  • 7
  • 12

0 Answers0