Any reason why I cannot take a screenshot of my application with the built-in ICS shortcut?

Firstly, this may seem like the wrong place to ask about it ... But since I just noticed this problem with my own application, I think there is no other place to ask about it. Maybe I'm doing something wrong, but I have no idea what ...

As you probably know, ICS allows you to take a screenshot on the screen by pressing Power + VolumeDown . I have HTC One X, and the shortcut is Power + Home . I don't know if this will change anything (maybe someone with a Galaxy Nexus can try it).

My own application, Notification Agenda (I am not going to bind it, so I am not accused of SPAM or something like that, but I really cannot post this question without the self-promotion that caused my application) t let me take screenshots with the above key combination with my One X. I can take screenshots of any other application, but it does not work on its own ...

What the hell do you think I'm doing to "disable" this? My application is very simple, and not much is happening for this. Any ideas?

Every time I try to take a screenshot of my application, I get this in logcat:

 08-24 00:15:40.570: E/InputManager-JNI(277): An exception was thrown by callback 'interceptKeyBeforeDispatching'. 08-24 00:15:40.570: E/InputManager-JNI(277): java.lang.StringIndexOutOfBoundsException: length=83; regionStart=-1; regionLength=83 08-24 00:15:40.570: E/InputManager-JNI(277): at java.lang.String.startEndAndLength(String.java:593) 08-24 00:15:40.570: E/InputManager-JNI(277): at java.lang.String.substring(String.java:1474) 08-24 00:15:40.570: E/InputManager-JNI(277): at com.android.internal.policy.impl.PhoneWindowManager.interceptKeyBeforeDispatching(PhoneWindowManager.java:2375) 08-24 00:15:40.570: E/InputManager-JNI(277): at com.android.server.wm.InputMonitor.interceptKeyBeforeDispatching(InputMonitor.java:307) 08-24 00:15:40.570: E/InputManager-JNI(277): at com.android.server.wm.InputManager$Callbacks.interceptKeyBeforeDispatching(InputManager.java:663) 08-24 00:15:40.570: E/InputManager-JNI(277): at dalvik.system.NativeStart.run(Native Method) 

This does not happen when the screenshot works. Instead, many other screenshot application calls are logged and more.

Why does my application prevent a screenshot and generate an error above?

+7
source share
3 answers

I would check if the application that takes the screenshot (the one who responds to the key combination that you are talking about) is registered as a system application. Android by design stops applications from sharing the framebuffer, so any application that tries to take screenshots will not.

Delve into the behavior and design of the application.

0
source

One thing that can cause this is to enable FLAG_SECURE for your window. http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE

+4
source

I had the same problem. You can use the DDMS perspective for Eclipse to take screenshots, just launch the application, enter the DDMS perspective and click the camera icon on the β€œdevices” tab

0
source

All Articles