Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Screenshot save dialog

GameMaker & Construct 2 plugins to let user pick where to save screenshot(s). · By YellowAfterlife

Android Screenshot

A topic by m16a2 created Apr 22, 2019 Views: 378 Replies: 3
Viewing posts 1 to 2

Can you make the same function for Android? I've been looking for such extension or command from a long time. There is nothing that can save a screenshot outside of the sandbox location for Android. Please help!

Developer

You can probably get in touch with the author of this image picker extension if you need to hire someone to make you such a thing.

Thank you for the answer, much appreciated. I actually don't need to trigger the android save dialog, I just want to make a screenshot outside of the sandbox. I have tried to create an extension for GMS(1), because "screen_save" and "surface_save_part" works, but save the .png files to the restricted location, available only for rooted devices (/data/data/<package name>). This is the .java script I'm trying to create

package ${YYAndroidPackageName};
import ${YYAndroidPackageName}.R;
public class android_screenshot {
    public void take_scr() {
     adb shell screencap /sdcard/screen.png
     adb pull /sdcard/screen.png
     }
}

File > Create Application > Error

BUILD FAILED

Z:\com.companyname.screenshot2\src\main\java\com\companyname\screenshot2\scr_capture.java:9: error: ';' expected adb shell screencap /sdcard/screen.png ^
Z:\com.companyname.screenshot2\src\main\java\com\companyname\screenshot2\scr_capture.java:9: error: not a statement adb shell screencap /sdcard/screen.png ^
Z:\com.companyname.screenshot2\src\main\java\com\companyname\screenshot2\scr_capture.java:9: error: ';' expected adb shell screencap /sdcard/screen.png ^
Z:\com.companyname.screenshot2\src\main\java\com\companyname\screenshot2\scr_capture.java:10: error: ';' expected adb pull /sdcard/screen.png ^
Z:\com.companyname.screenshot2\src\main\java\com\companyname\screenshot2\scr_capture.java:10: error: not a statement adb pull /sdcard/screen.png ^
Z:\com.companyname.screenshot2\src\main\java\com\companyname\screenshot2\scr_capture.java:10: error: ';' expected adb pull /sdcard/screen.png ^
6 errors
:com.companyname.screenshot2:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':com.companyname.screenshot2:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
----------------------------------------------------

I've got these 2 android commands from here
http://adbshell.com/commands/adb-shell-screencap

some other info
https://adbinstaller.com/commands/adb-shell-screencap-5b69ae0032e0461ad1db1ca8

https://code.google.com/archive/p/android-fb2png/

https://stackoverflow.com/questions/32883784/which-commands-line-are-used-to-take-a-screenshot-on-android-device-except-scre

https://stackoverflow.com/questions/45133089/take-screenshot-with-adb-and-retrieve-it-in-java-without-writing-a-file

https://stackoverflow.com/questions/27766712/using-adb-to-capture-the-screen?lq=1
-------------------------------------------------------
I believe it's not that hard to achieve this, but with little help...

Developer

An admirable attempt, but you copypasted a bit of BATCH/Bash into your Java code, which will not work.

An easier way around might be to figure out how to copy a file in Java on Android.