Cannot resolve Method getSupportFragmentManager() or ((FragmentActivity)activity)getSupportFragmentManager()

I want to launch a fragment from my BroadcastReciver class because I want to launch a fragment on a mobile home screen just like a dialog. using that user will stop or snooze the alarm. how to achieve that?

I tried all solutions available at StackOverflow but I can’t get an answer. every time I am getting an error.

any suggestion or question? comment below

Source: Android Questions