Customize Android App Screen Image which is visibl

2019-02-19 19:37发布

I'm wondering how to customize the Image for My App to Home Screen image when My app is in background mode, that is when user navigates between Apps in recent apps option where a small screen shot for all running apps is visible.

Eg: Image Attached for more clarity. enter image description here

1条回答
戒情不戒烟
2楼-- · 2019-02-19 19:57

See the following questions:

So theoretically there are two potential solutions:

  1. Override Activity.onCreateThumbnail() to customize the thumbnail.
  2. Add FLAG_SECURE to the window to prevent thumbnails (and screenshots).

Activity.onCreateThumbnail() sounds awesome until you realize it's been broken since Android 4.0.3 when the method call was commented out. See above posts or be direct, see the Android source code:

// First create a thumbnail for the activity...
// For now, don't create the thumbnail here; we are
// doing that by doing a screen snapshot.
info.thumbnail = null; //createThumbnailBitmap(r);

Currently, there is no easy way to customize the thumbnail.

So that really only leaves FLAG_SECURE. This doesn't allow you to customize the thumbnail, but rather prevents it, e.g. password forms and sensitive information. There's a downside to using the flag- it will also prevent screenshots, screen capture, and mirrored displays.

查看更多
登录 后发表回答