Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize Android App Screen Image which is visible in switch between Apps screen

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

like image 961
Baidyanath Avatar asked Dec 19 '22 06:12

Baidyanath


1 Answers

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.

like image 101
Funktional Avatar answered Apr 26 '23 23:04

Funktional