Android: Getting notified when a screen capture is done - android

Is there any way to get notified when a screen capture is performed using the soft key or the device hard key on android? Any way that works 2.3 onwards will help greatly.
Use case:
I already block screen capture using FLAG_SECURE. I want to show a Custom Dialog to the user when this action is performed. Android supplied mechanisms vary. Sometimes a notification is seen while at others, a blank screenshot is captured with no user feedback.

Is there any way to get notified when a screen capture is performed using the soft key or the device hard key on android?
No, sorry.

Related

How to prevent Screen Capture in Android without using Secure Flag?

I am working on 1 application for Video chatting where I need to implement the following functionalities.
During video chat if anyone tries to capture a screenshot of the screen then he can able to take a screenshot but at that time I need to show a warning popup message and report to the admin.
But if I use "Secure Flag" then it will prevent taking screenshots but I can't able to show a warning popup message and report to a user.
Similar way if anyone tries to capture screen recording then can't able to record and we can show warning popup.
By using "Secure Flag" we can prevent taking screenshots and screen recording but we can't get any event and due to that we can't show warning popup messages.
Neither of those are possible, sorry. Your app is not informed about apps using the media projection APIs, which includes any device-supplied screenshot/screencast tools.

Android . Activating my application when some string was entered in some other application

I am trying to create a behavior where entering some string in any application will open my application.
I've tried looking around on how to listen for keyboard press or listening for text change, but I couldn't find my required behavior and I don't want to create a custom keyboard for this.
If this is not possible, what will be a good implementation for lunching my application as fast as possible while in the other application?
Answered before the requirement to "don't want custom keyboard"
The only viable way that I can think of is if the user was using a custom keyboard written by you. Custom keyboards can and do act as key-loggers and therefor could detect any key combination, or written word and allow you to execute your code when your conditions are met.
Rerfer to Creating an input method docs
How to open my app as fast as possible from another application?
Press home, launch your app by clicking on the launcher icon
But assuming you mean without doing that, you'll still need to monitor some event, say volume keys pressed or device being shaken for instance, or have you app be running already in the foreground such as what Facebook messenger does (or used to do, I don't know)
Related questions:
What APIs in Android is Facebook using to create Chat Heads?
Listen to volume buttons in background service?
How to detect shake event with android?
Demo of bubbles

How to handle ALT+TAB key from Bluetooth Keyboard in Android Activity?

I want to capture ALT+TAB keys pressed from Bluetooth Keyboard connected to Device, and i want to do some custom action in my application.
As by default this Key Combination shows Recent Tasks.(May be in PhoneWindowManager.java::ShowOrHideRecentAppsDialog).
So i want to disable this action and want to handle this in my App. May be with help of onKeyShortCut() Function or so.
Can someone help me with some sample piece of code ?
FYI: If require , can make changes in Platform also.
Thanks a lot

Find out if device has softkeys

In recent versions of Android it's possible for devices to either have software or hardware buttons. I'd like to find out which is the case for the device my app is running on.
Some background information: It is possible to hide the softkeys as they are displayed on the screen but if you do this they automatically get shown if the user touches the display which is perfectly fine. Now if you do the same on a device with hardware keys the first touch still gets caught by the system like as if it would show the softkeys again but as there are none, nothing happens and the touch event does not get passed to the app.
You could use ViewConfiguration.hasPermanentMenuKey(), to check for a menu key.
For the Keyboard-question try
getResources().getConfiguration().keyboard
that gives you one of the following:
KEYBOARD_NOKEYS
KEYBOARD_QWERTY
KEYBOARD_12KEY
check for KEYBOARD_NOKEYS.

Android user presses a key

Is there a way to register a receiver for a app running in the background for when a user presses a key. Kind of like "ACTION_USER_PRESENT" but if any keys were pressed on the screen.
MORE DETAIL: My app is running as a service in the background. User opens the phone and presses keys, like they searching for something online on their driod. Can I capture those key presses in the background?
To detect whether a user is using the device you could also use the information whether the screen is on or off as an approximation (making the assumption that the screen timeout is set). This blog entry shows how to capture the screen on and off events (I haven't done it myself though).
In the Android HCI Extractor ( http://code.google.com/p/android-hci-extractor/ ) we traverse the GUI and install some event filters (by using listeners) in the app top view.
Maybe if you can reach a top level view from which listen the events you could listen to all the events for this view. Let's try ;-)
This tool is an open-source prototype you can find here: http://code.google.com/p/android-hci-extractor/
It is very easy to integrate and use. In the tutorials you can see that only a few lines of code are needed: http://www.catedrasaes.org/trac/wiki/MIM
I hope it helps you!!

Categories

Resources