I have an app in android that I want to protect it's content when the app goes to background or mainly when the user pressed on the home button. If I go to switching between apps I can see a small thumbnail there of my current app screen, which I want to protect it with some blur or another screen.
I tried blurring, dimming, changing colour in the onPause event, but it always takes the screenshot thumbnail for the switch apps as it is.
Do you have any idea or approach on this matter?
Have you tried disabling the thumbnail by adding FLAG_SECURE to your window on exiting?
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
Related
When the app is shown in the recents menu, I need to make the content blank, so that screenshots can not be taken.
This flag works
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
and the screen becomes empty white. I need to handle the scenario where the user has selected the dark mode, and so the screen must be empty dark.
What other options can I have other than using this flag?
Sorry, but you do not have control over how the OS displays your app in the overview screen, in terms of the color when FLAG_SECURE is used.
I have found this library on github that solves the problem.
https://github.com/nimblehq/recent-apps-thumbnail-hiding
You can use custom layout for the recent app views.
Using FLAG_SECURE, when app goes to background screen info are invisible, however, with this option users cannot take a screenshot anymore.
it's there any way to remove FLAG_SECURE when app back to FOREGROUND ?
Or any other solution for this problem ?!
You can put a black or white background in onPause and hide it in onResume if you dont need the FLAG_SECURE always active. This could prevent the window manager to exposes the screenshot in the window manager screen.
I have encountered a problem where user will exit my application accidentally. I know Android is preventing to block use of these buttons, because you should always be able to exit your app somehow but I am creating an app for blind and visually impaired people and I will implement a special exit the app so they won't close it when they will be using it.
Here are some things I gathered:
I can block the onBackPressed() function and prevent going back.
I can't use onKeyEvent() since it won't grab the home click
Good example is MX Player where you can "lock" your screen but it just draws over the whole screen, thus preventing user to click on anything.
Ok, so I would like to grab the same thing as MX Player, except, I would like for user, to still have interaction with the screen.
I tried using Immersive full screen that Google has introduced for full screen apps, but whenever user slides his finger on the screen, Navigation Menu popus up. Can I keep this hidden at all times? Also, can I prevent the slide from Status Bar to display the buttons? I would like to have full control of how the user is moving their finger over the screen.
So if I go back to the MX Player solution - drawing over the screen. Can I create like a Canvas that doesn't have focus and it's just there to prevent the clicks on the buttons?
Any help is very much appreciated. Thanks.
I'm working on a lockscreen widget(not trying to be specific here, but Nexus 7 ) . The widget has a button which would trigger an activity.When the user clicks the button, the unlock slide symbol get's highlighted hinting the user has to slide-unlock his screen before he wants to see the button's activity. Since now, the device is locked,is there a way to bypass this and just display the activity on top of the lock screen? (not in the case of pin/pattern obviously, but only just slide)
Was searching a lot for a way to do it. We need to use flags in while giving an intent to the widget button. More information here.
Android Lock Screen Widget
Is there a way to control what's shown on the screen when an Android app is restarted after it has been stopped? By stopped I mean the apps has been sent to background and at some point the OS reclaimed the resources.
Now when I select the app from the task switching view it shows the ActionBar and black background (the background in fact has been set transparent to reduce overdraw) and after a couple of seconds it resumes the activity.
Would it be possible to show some sort of loading indicator (e.g. a ProgressBar) instead of just black background?