0

这在棒棒糖上完美运行:

recents_button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            Intent intent = new Intent ("com.android.systemui.recents.SHOW_RECENTS");
            intent.setComponent (new ComponentName ("com.android.systemui", "com.android.systemui.recents.RecentsActivity"));
            startActivity (intent);
        }

但在棉花糖上,我得到:

java.lang.SecurityException: Permission Denial: starting Intent { act=com.android.systemui.recents.SHOW_RECENTS cmp=com.android.systemui/.recents.RecentsActivity } from ProcessRecord{96f7c1e 4931:com.myapp/u0a188} (pid=4931, uid=10188) not exported from uid 10043
4

1 回答 1

2

您可以看到,意图不是由 Marshmallow 导出的,而是由 KitKat导出的。

Tasker 能够显示最近的应用程序对话框,我不知道它是如何做到的。

于 2017-02-19T19:38:53.890 回答