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.
Related
I'd like to offer an app to modify images. In order to have the user give an easy access to the that feature, it would be the easiest solution to just let him directly take a screenshot to have the source picture taken or respond to a screenshot event and access the latest screenshot.
Unfortunately it seems to be a problem, since an app or even a service from the app runs in background cannot easily react to events and I haven't found any solution that would go only little close to that kind of thing.
So my questions are (lets assume all necessary permissions are given from the user):
Is there a possibility to register my app as kind of standard screenshot app (or additional screenshot app triggered by another key combination of the device) and how ;-)
Can an app stay in a state to notice if a screenshot is taken and
can access it?
If not: Any ideas for an workaround other than let the user select a taken picture, which is rather kind of roundabout and annoying?
Any hints are very welcome! Thank you in advance!
(Since I had a misleading headline, I reposted this question - sorry!)
I want to take a screenshot of an Activity of my application, but I do not have the code of that activity (only its class file since it is imported from an external API) so am not able to modify the UI and add an event which will help me taking the screenshot.
Thus, I thought about using a background Service which can detect all application's activities and to take the screenshot if matching the wanted activity with some condition.
I have browsed many question/answers about the subject, but nothing matched what I want to do.
So, I will be very grateful for any help, or suggestion about this.
Thank you.
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.
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.
I am new to Andorid development.
I am trying to write a small application for Android device.
One thing that I want is to get information from another installed application.
EDIT:
I want my application to do A and B, and I found a application that already does part A,so what I am trying to do is to extend the functionality of the existing application
is there a generic way to retrieve information from another app?
#dprogramz gave a really good answer but to build on it you may want to take a look at startActivityForResult if you're looking to get a photo or use input from some external activity.
Documentation is here
What information?
If it is shared information that lives in a shared directory then it shouldn't be any problem at all.
If it is protected information you will have to give your app access to these files.
If it is "real-time" information you will have to invoke an API. take a look at the application class
http://developer.android.com/reference/android/app/Application.html
yes, there is a possibility to extend a app X with a feature A. You can add a new feature B to the app and make it more scalable and realiable,
only if-
Project is Open-Source:
You can contribute to the app via github and push changes.
If the owner likes it, you can be hire.
OR
Download the existing the project, make changes and upload it.