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.
Related
I am trying to create an Activity that provides a screen to select icons. After this selection, this app should work as follow:
1- Each selected icon should appear in the home screen, with its own image. These icons should not be available as apps in the application catalog. They should behave as simple shortcuts, added or removed directly by the main activity;
2 - When I press on one of these icons on the home screen, I want to launch a Activity that should have specific behavior, based on which icon was pressed.
Is it possible to implement this requirements? Can you help me with some guidelines or workarounds to solve this?
Thank you very much for your support.
José Reviralho
Each selected icon should appear in the home screen, with its own image
I am assuming that "its own image" == "selected icon".
You cannot change the icon associated with an activity at runtime. If the roster of icons is reasonably small, and they are all drawable resources, you could try having one <activity-alias> per icon, all disabled by default, then use PackageManager and setComponentEnabledSetting() to enable one the user chooses. If the user can choose the same icon more than once, you would need to have N <activity-alias> elements per icon (so the app can show up in the launcher for each selection). This can get very wordy very quickly.
They should behave as simple shortcuts, added or removed directly by the main activity
If by "simple shortcuts" you mean "icons in the launcher/app drawer", the <activity-alias> elements would each have the standard MAIN/LAUNCHER <intent-filter>, so the ones you enable will show up there.
Note, though, that not all home screen implementations will detect when you enable and disable these things, so users may need to reboot if the icons are not showing up.
When I press on one of these icons on the home screen, I want to launch a Activity that should have specific behavior, based on which icon was pressed
You cannot change what activity an <activity-alias> points to at runtime -- that is hard-coded into the manifest. Either:
You will use one activity for all icons, with different fragments for each distinct icon, or
You will need to have the <activity-alias> elements all point to one activity that uses Theme.NoDisplay, which in turn can determine the right real activity to start up, or
You will need M <activity-alias> elements per icon, one per possible activity, so that you enable the right one for the right icon/activity combination
Is it possible to implement this requirements?
In summary, this will not be easy to implement, though in theory it should be possible.
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);
I am developing a magazine reader application aimed at the Kindle Fire. In landscape mode the built in softkey bar and status bar in the Kindle's operating system leave little room for my content so I have opted to run the activity in fullscreen mode using the following theme for the activity:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
This works fine, the status bar is hidden and the softbar is minimized like so:
I can bring up the menu bar by dragging it up like so:
The bug arises when I then click somewhere on screen to dismiss the softkey bar. The bottom bar slides back away, the top one does too but the space that it took up becomes a black void and my app is pushed down underneath it so my tab bar at the bottom of the app is now unusable:
I am using a tabhost activity here and the tab I am on in these screenshots is the actual reader section of the app. This subactivity uses a PDF viewer widget which is written using native code and this bug only happens on this tab. If I switch to one of the other tabs which contain no JNI code this bug does not happen so I'm pretty sure its the combination of the Kindle Fire OS, the fullscreen activity and the use of JNI code.
Has anyone else experience this issue?
Any help much appreciated!
Thanks
There are a couple of fullscreen modes for the Fire (at least the new ICS based ones) - check out https://developer.amazon.com/sdk/fire/cx-guidelines.html#Fullscreen for the options. I suspect the ICS Full Screen mode will be what you need
Also it's probably worth trapping the onOrientationChanged and onSizeChanged events to make sure you re-draw the screen correctly when the menu/toolbars appear and disappear per the screen layout sample at https://developer.amazon.com/sdk/fire/samples.html
Screenshots Below. As you can see, my menubutton is showing up in the actionBar's overflow area. It doesn't work well on portrait, because it adds a second row (cannot fit next to my tabs, obviously); it looks okay on landscape, but I will be changing the way the tabs present themselves on landscape, so it'll end up having the same problem as portrait. So, what I need to accomplish, is getting the menu button into the bottom black area of the screen, which, my understanding says is actually legacy support. Is there no method to declare to send my menu button down to the right of task switcher as I've seen in some other apps? Is the solution to change my targetSDKversion in AndroidManifest?
Can't be done, as can be seen via CommonsWare's link :(
There should be a bunch of buttons on dark gray background right of the phone screen. I started playing with the keyboard shortcuts available in that window and I must have done something to make the whole right-hand side of the emulator window disappear. How do I restore it?
This may be of help: http://www.android.encke.net/android-emulator-tutorial.html - Ctrl-F11/F12 may get you back in order.