How To get screen content of android default screens - android

I am currently trying to draw a line on top of a textview content in android default screen for example., settings screen. it is possible to get content of the screen if that screen belongs to our own application, i want to know how can i get content of device default screen content from my application. as part of going through few discussion i got if we get the view object of that screen we can able to do that. so is it possible to get the view object of a android default screen? kindly help on how can we achieve this.
thanks

so is it possible to get the view object of a android default screen?
No. That app runs in another process. Its objects cannot magically transport themselves to your process.
i want to know how can i get content of device default screen content from my application
On Android 5.0+, with user permission, you can use the media projection APIs to take screenshots.

Related

Capture android screen for text

Im trying to build an app that can copy and save all text that user selected in any othe apps such as chrome, adobe reader, sms .....
In fact I have no idea how should I do that or even is that possible or not
I will be thankful if any one can help me.
The Accessibility API allows you to investigate the view hierarchy displayed on the screen and read text from different views. On top of that, you may be able to fetch the coordinates of where user tapped (maybe by using some kind of system overlay view) and translate them to the position of text the user most likely wanted to copy. Note that if this even works at usable level, will be very hacky and most likely making it work across considerable number of devices will be hard.

Android record screen but only specific 'layers'/views

I use the MediaProjection API to record a screen in Android. Now I want to know whether it's possible to create a let's say "hidden" view which you actually can see but not in the video thus the view shouldn't be recorded. Furthermore is it possible to disable the recording of notifications or even the notification-center?
So is it possible to configure like a 'surface-layer-system', thus you can decide which layer you want to record?
Preventing a layer from appearing in recordings can be done by setting the "secure" flag. See for example the "multi-surface test" in Grafika, which sets the flag on one of its SurfaceViews.
You will configure a virtual display to only show your app's own windows if you use createVirtualDisplay() directly, rather than going through MediaProjectionManager. Because you're creating a display for your own content, the user permission dialog is not shown. See for example the tests for DisplayManager#createVirtualDisplay().
You can use EZ filter to record particular layout.

ARC app resize window event

Now that android apps can be run on the Chrome OS and using {"resize":"reconfigure"} they have become re-sizable, there is now a need for more responsive layouts. In order to make my layout more responsive I need an event listener that knows when the app window changes size.
Is there anyone out there doing this and how?
FYI: I want to do something similar to polymers Scaffold concept(https://www.polymer-project.org/0.5/components/core-elements/demo.html#core-scaffold)
ARC does not send a simple application level event on window resize. Android does define a resize event which is used when the virtual keyboard pops up, but this isn't useful to ARC since it is more about restricting your app to a smaller portion of the display (which is still the same size)
Instead it sends more of a system level event, causing the Android code to think that the display size has changed. This is substantially the same as what happens when you rotate an Android phone causing an orientation change event to propagate. The Android framework then passes this on to your app as the standard Activity.onConfigurationChanged() call.
You should be able to then use the values contained in the passed Configuration newConfig argument (such as screenWidthDp and screenHeightDp) to decide how to display your UI.

Customize Android App Screen Image which is visible in switch between Apps screen

I'm wondering how to customize the Image for My App to Home Screen image when My app is in background mode, that is when user navigates between Apps in recent apps option where a small screen shot for all running apps is visible.
Eg: Image Attached for more clarity.
See the following questions:
Is there a way to change the thumbnail of an app in the android task
switcher (long press on home button)
How to force app to create
thumbnail (snapshot) for recent apps list?
How do I prevent
Android taking a screenshot when my app goes to the background?
So theoretically there are two potential solutions:
Override Activity.onCreateThumbnail() to customize the thumbnail.
Add FLAG_SECURE to the window to prevent thumbnails (and screenshots).
Activity.onCreateThumbnail() sounds awesome until you realize it's been broken since Android 4.0.3 when the method call was commented out. See above posts or be direct, see the Android source code:
// First create a thumbnail for the activity...
// For now, don't create the thumbnail here; we are
// doing that by doing a screen snapshot.
info.thumbnail = null; //createThumbnailBitmap(r);
Currently, there is no easy way to customize the thumbnail.
So that really only leaves FLAG_SECURE. This doesn't allow you to customize the thumbnail, but rather prevents it, e.g. password forms and sensitive information. There's a downside to using the flag- it will also prevent screenshots, screen capture, and mirrored displays.

take picture from device screen content (not a view) programmatically in android app

i'm developing an app and need to make Activity that take snapshot from current content of device screen.
note: i dont want take picture from my activity content or some view, i want take a picture from all of device screen content. ( like home screen or every applications that are on foreground). i googled many times and search so much.
there is an example code:
View screen = (View)findViewById(R.id.screen);
screen.setDrawingCacheEnabled(true);
bmScreen = screen.getDrawingCache();
showBitmap(bmScreen); // function that show my bitmap image
with this code can capture my activity's view, but i dont want capture onlye my activity. i want make a thread that capture device screen with all of its contents.
can everybody help me please?
You can't do this, mostly for security reasons. If this were possible, some rogue app could silently capture and send somewhere screenshots of everything you are doing on your device.
Why this is not available to non-system apps:
Android let's SDK applications do certain things, and explicitly forbids others. An app is not supposed to read another app's data and similarly an app cannot capture another app's screen. Google has explicitly said that third party apps are not supposed to take screencaptures of other apps. The lack of screen capture API's is a deliberate decision, not an omission. ICS offers screenshot functionality, but it is implemented by the system, and requires a hardware trigger in order to make sure it cannot be started or accessed by third party apps.
While there are ways to do this, they either require root (to read the graphics buffer directly, which is device-dependent), or are not guaranteed to work on all devices/versions.

Categories

Resources