Android task manager or system dialog

后端 未结 2 2031
忘了有多久
忘了有多久 2021-01-17 03:15

I would like to know is there a way to get events while displaying a System dialog (Such task manager, shut down alert,...).

I can close the system dialogs from my a

相关标签:
2条回答
  • 2021-01-17 03:41

    put below method in your Actvity and check recent app dialog close automatically.

    public void onWindowFocusChanged(boolean hasFocus) {
            super.onWindowFocusChanged(hasFocus);
    
            Log.e("Focus debug", "Focus changed !");
    
            if (!hasFocus) {
                Log.e("Focus debug", "Lost focus !");
    
                Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
                sendBroadcast(closeDialog);
            }
        }
    

    Note: it only work for single Activity. not for all activity in your app.

    0 讨论(0)
  • 2021-01-17 03:49

    Use Broadcast-Receiver and place intent inside onreceive() method.Then register this receiver where you display your alert dialog. Then it automatically disable settings,recent apps button ----Nagesh

    0 讨论(0)
提交回复
热议问题