package Ġcom . github . p jo z se f . extension . android . broadcast Ċ Ċ import Ġandroid . content . Broadcast Receiver Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . content . Intent Filter Ċ Ċ fun ĠContext . broadcast ( init : ĠIntent . () Ġ-> ĠUnit ) Ġ{ ĊĠĠĠ Ġval Ġintent Ġ= ĠIntent () ĊĠĠĠ Ġintent . init () ĊĠĠĠ Ġsend Broadcast ( intent ) Ċ } Ċ Ċ fun ĠContext . register Receiver ( receiver : ĠBroadcast Receiver , Ġvar arg Ġactions : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġfilter Ġ= ĠIntent Filter () ĊĠĠĠ Ġactions . forEach Ġ{ ĊĠĠĠĠĠĠĠ Ġfilter . addAction ( it ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġregister Receiver ( receiver , Ġfilter ) Ċ } Ċ Ċ class ĠReceiver ( val Ġon Receive Callback : Ġ( Context ?, ĠIntent ?) Ġ-> ĠUnit ) Ġ: ĠBroadcast Receiver () Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġon Receive ( context : ĠContext ?, Ġintent : ĠIntent ?) Ġ= Ġon Receive Callback ( context , Ġintent ) Ċ }