BroadcastReceiverConfig
Defines the reference to a broadcast receiver.
Broadcast receivers are not managed by the IVI platform in any way. The IVI build config only allows broadcast receivers to be deployed in a process with a configurable name. For instance, it is possible to deploy a broadcast receiver in the same process as an IVI service host without the need to hardcode the process name of the broadcast receiver in an AndroidManifest.xml
file. To do this you need to deploy a BroadcastReceiverConfig in a RuntimeDeploymentConfigurator.Global with RuntimeDeploymentConfigurator.Global.deployBroadcastReceiver.
Example
val broadcastReceiver = BroadcastReceiverConfig("com....Receiver")
val someServiceHost = IviServiceHostConfig(...)
ivi {
application {
enabled = true
services {
addHost(someServiceHost)
}
globalRuntime {
create(RuntimeDeploymentIdentifier.global) {
applyDefaultDeployments(all())
deployServiceHost(someServiceHost)
deployBroadcastReceiver(broadcastReceiver).inSameProcessAs(someServiceHost)
}
}
}
}
The above example deploys com....Receiver
in the same process as the someServiceHost
.
Note: The IVI build config does not manage the Gradle dependencies to include the referenced broadcast receiver into the build.