This question already has an answer here:
-
How to take a screenshot of other app programmatically without root permission, like Screenshot UX Trial?
3 answers
I am developing an application in which there is a button on click of that button i want the screenshot of android screen not that application screen my phone is unrooted. Is it possible to take screenshot of unrooted phone.?
Yes it is possible.
have a look at Android Screenshot Library.
Android Screenshot Library (ASL) enables to programmatically capture screenshots from Android devices without requirement of having root access privileges. Instead, ASL utilizes a native service running in the background, started via the Android Debug Bridge (ADB) once per device boot.
How to Implement?
Modifying the manifest XML
In order for Android service to be accessible, add the following declaration to your client application's XML manifest:
<service android:name="pl.polidea.asl.ScreenshotService">
<intent-filter>
<action android:name="pl.polidea.asl.ScreenshotService.BIND" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
Binding service
To obtain the IScreenshotProvider interface one must bind to the ASL service (pl.polidea.asl.ScreenshotService) using Context.bindService - for example:
// (using class name)
Intent intent = new Intent();
intent.setClass (this, pl.polidea.asl.ScreenshotService.class);
bindService (intent, aslServiceConnection, Context.BIND_AUTO_CREATE);
References
- https://code.google.com/p/android-screenshot-library/wiki/DeveloperGuide
- https://github.com/rtyley/android-screenshot-lib