How to call MainActivity from BroadCastReciever

Thanks, mm, what about if I need the receiver to keep running regardless the active activity, and its response to be varies based on the active activity itself! Is there a way that I can detect the active activity from my , something like:

class Receiver : BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent) {
         // check the active activity
         // if MainActivity then ....
         // if OtherActivity then ...
   }
}