How to change the snapshot shown by recent apps list?

后端 未结 2 406
逝去的感伤
逝去的感伤 2020-12-05 20:13

In the newer versions of Android (> 3.0) there is an onscreen button that will display a list of the recent apps with their names and snapshots. Even though my app itself

相关标签:
2条回答
  • 2020-12-05 20:41

    The solution provided by Azat continues to be valid also in Lollipop.

    Just a note, if you want to continue to not see snapshots in recent list for the entire app, ALL the implemented activities should specify in the onCreate() method the flag getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); before setContentView();

    Otherwise a snapshot in the recent list will show the first activity without the flag if the user navigated through it.

    0 讨论(0)
  • 2020-12-05 21:00

    It seems to be impossible for now. There's a method called onCreateThumbnail but it is not used currently by the system I guess, since it is not called. I see two possible solutions:

    1. To disable thumbnail on the activity containing sensitive data by adding FLAG_SECURE to your window: getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
    2. To exclude your activities from recent apps, set android:excludeFromRecents attribute to true for activities in AndroidManifest.xml

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