You can achieve this in two ways:
Using window flags:
Open the operation A that you want to run in onReceive(...) . Insert this into the onCreate() this activity A
final Window win= getWindow(); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
Make sure you don't insert it before setContentView(...)
source share