androidbackgroundforeground

Background application UI has to become blurred when the user sends the foreground app to background by pressing the device home button


User sends current running application in android device to background and when try to see all background application in device user should not able to see content of the background application. instead of that user has to see either blurred or blank screen and on tap it when application comes on foreground user can able to see actual content.


Solution

  • Set this in onCreate method between super.onCreate(savedInstanceState) and setContentView:

     // White image on recent apps overview and disable screenshot functionality
     window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)