First of all yes i know its not possible to code this in my app without root permission.
I need to take screen shot even outside my app without root.
I just need to know if i can request Android os for me to take a screen shot for me via some intent.
I wont have much control over it but is it possible?
Currently do not exists intent for this.
You can see the documentation of Intents broadcast by the system
You can take a screenshot in an instrumented test ("androidTest") using https://developer.android.com/reference/android/app/UiAutomation#takeScreenshot() for example:
InstrumentationRegistry.getInstrumentation().getUiAutomation().takeScreenshot();
This works outside the context of the app. Not sure if it serves your particular purpose, but it's an option.
Related
When I go to the descitption of a certain app that have android.permission.CAMERA in application inspector it says : "...to take photos and videos at anytime"
I find it confusing and would like to know if anytime refers to anytime when the app is active i.e. open, or any time like it can activate it self in a background process and access the mentioned device.
The only doc i could find is https://developer.android.com/training/permissions/usage-notes but it does not answer my question.
It is possible to take pictures/videos without showing the preview. But it is complicated depending on the android version. There is even a libary which handles it:
android-hidden-camera
my goal is to get a video from a usb connected device (an easycap video grabber) displayed. There is already an android app that does exactly that. However i need to add some buttons and some extra functions to it. So i came to the idea of displaying the app that already exists inside my app. Is that possible in any way?
I already tried to decompile the existing app to edit the code a bit but i didn't get anything to work with.
Do you have any other idea? If you know how to program that please let me know what i need to achieve that.
Thank you!
This cannot be done due to security reasons in the Android OS itself.
Android provides a security layer called the Sandbox in which the OS assigns a User ID for each app, so that an app will not have permission to access resources from another app.
I am trying to archive same thing as done in "hierarchyviewer" tool, which dumps the tree of Views present at any given moment on the device or emulator screen.
But i want it to be an Application running on a Android device. This app will keep running in background like a Serve and will dump the currently displayed Views in a text file.
Is it possible? is there any code examples are available?
Is it possible?
No.
The closest you can come is to implement an AccessibilityService. This would more closely mirror the uiautomatorviewer functionality, giving you a subset of what you see in Hierarchy View. This also requires a double-opt-in by the user: the user must install your app and activate it in Settings in the accessibility area.
As far as I know, you couldn't access other apps if they do not explicity share that info with you by the use of Intents (or if you own these other apps).
So, based on this limitation, my bets are you can't access another app's View Tree by regular means. And if you chould, I think you shouldn't, as this is somehow "secret" to other apps, and you'd be registering information without permission. In fact, what hierarchyview uses is, for sure, some sort of trick that directly uses internal private libraries of Android. Like taking a screenshot, that you can't do with the "default" implementation, but using these kind of testing tools.
That being said, check this answer, where it shows how to get the current app in foreground. From here, getting the View tree should be impossible, but as long as you could call getWindow() on that app's current activity, this could be done.
In my application i have done all the process and they are working very well. Now my device needs only one application or other application must not come front to the user's view..
Can I make my Application as Default application or the only application viewable by the user?
To avoid the unnecessary usage of other applications or to keep time consumption I plan to try this.
Would I need to change anything in the Manifest.xml file of this solution solve this?
You cannot do this on a stock device. Your best bet is to create a launcher that only allows launching your app. The user needs to agree to run it however, and it can always be changed and/or disabled in Settings.
I am running one external application from my own application and when this application opens, i want to get a view of that external application in my own application. So that i can capture a screenshot of it. Please help me in this.
I dont think thats possible. The communication between applications or even activities is limited to passing data to each other through intents. I don't think sharing references to objects across applications is possible. Please correct me.
Such a thing would be possible if they allowed you to launch an external application in your own window.
I did some search and it is quite likely it may not be possible, however I have found a possible way. Take a look at this link, which states that
Or If you want to take a ScreenShot of your current device screen (any
application) then you have to root permission, and read framebuffer
for that which will give raw data of current screen then convert it to
bitmap or any picture file you can do it in your service.
Which means that whenever your application starts an application you will need to create a service that reads the framebiffer, but if an activity is used for taking the screenshot then it will not be useful because the screenshot will then be of that activity.
See this and this, these links are related to your question as well. And see if it works.
Hope this helps.