How to get screenshot of Application on Android Things device in Android Studio or via ADB?
Asked Answered
A

3

2

Is there any way to get screenshot in Android Studio (or via ADB) for Raspberry Pi 3 Model B with Android Things Developer Preview on it? (any other way not via Android Studio/ADB also accepted).

Albite answered 10/1, 2017 at 20:17 Comment(14)
Try this: developer.android.com/studio/command-line/adb.html#screencap, or just take a screen shot from the terminal.Nonappearance
I was try developer.android.com/studio/command-line/adb.html#screencap - file created, but it's size is 0.Albite
How about this instead: raspberrypi.stackexchange.com/questions/7423/… ? I'm assuming you're on the GUI version.Nonappearance
That approach not going to work for me: there is Android Things OS on my Raspberry Pi board, not Raspbian.Albite
if everything else fails you can use Vysor and take screenshots on the PC twitter.com/blundell_apps/status/816024685100023809Lynden
My mistake. Then that only leaves my earlier suggestion, maybe try saving in different locations? I've never used Android Things, but I've taken screenshots from the command line on Android devices. Best of luck.Nonappearance
You might try this solutionCenotaph
@Cenotaph I was tried, and indeed got file with nonzero length, but I can't convert it to image by any utils (ffmpeg, ImageMagic etc.) :(Albite
@Andriy Omelchenko I've got just 2 parameters left to change in my solution: screen resolution and pixel format... Anyways, how did you convert the video gained by screenrecord in the accepted answer?Cenotaph
I'm just pull adb pull screen.mp4 file from Raspberry Pi 3 with by adb pull /sdcard/screen.mp4 command and play it in default windows mediaplayer. No video converter needed.Albite
@Andriy Omelchenko "I'm just pull adb pull screen.mp4 file...and play it in default windows mediaplayer" In this case it's called a video file, not screenshot, which is to be of png, jpeg, etc. formats.Cenotaph
@Cenotaph Indeed. But at least I got .mp4 file, which I can open in player. screenshot file from here I can't open in anywhere. By the way, how determine parameters (screen resolution or pixel format) for ffmpeg command line?Albite
@Andriy Omelchenko "screenshot file from here I can't open in anywhere" It doesn't mean the solution isn't working, it means you do use it in a wrong way. "By the way, how determine parameters" You should have known your display resolution, otherwise how did you configured your display on the first Android Things boot? Anyways, there are many ways, e.g. adb shell dumpsys window | grep mUnresCenotaph
@Cenotaph I'm never wrote that Your solution didn't working. I just wrote that I can't do anything with received file. May be someone can convert it. Thanks for ADB command (seems there is no need to know display resolution for Android Things boot). I will try Your solution again!Albite
T
3

It's not a "screenshot", but how about mp4 movie instead?

adb shell screenrecord --verbose /sdcard/screen.mp4 --time-limit 1

Though the recorded movie is not correctly recorded, it's still like a "screenshot". (I cannot get a frame out of it using QuickTime Player, but any other tool might be able to extract it.)

It seems that AndtoidThings supports old limited OpenGL version that unsupports screenshots.

01-01 00:00:10.606: I/SurfaceFlinger(148): version   : OpenGL ES-CM 1.0

01-22 02:07:02.687: E/libEGL(148): called unimplemented OpenGL ES API
01-22 02:07:02.687: E/SurfaceFlinger(148): glCheckFramebufferStatusOES error 0
01-22 02:07:02.687: E/SurfaceFlinger(148): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
Transitive answered 22/1, 2017 at 2:34 Comment(2)
My pleasure! どういたしまして^^Transitive
I doubt it's because of "old limited OpenGL version". I have OpenGL ES-CM 1.1 on my Android 4.2 phone and the screencap works as expected. Probably it's a buffer-handling thing...Cenotaph
R
1

You can get screenshot from Vysor application installed on chrome browser.To do this follow the procedure below.

  • install Vysor in chrome browser.
  • Connect PC with Pi using adb connect.
  • Open Vysor on PC and enjoy.
Rondi answered 13/1, 2017 at 9:36 Comment(0)
S
0

You can also use the Android Device Monitor. Open it from Android Studio menu Tools -> Android -> Android Device Monitor or run it from the sdk directory sdk/tools/monitor.

Sip answered 23/1, 2017 at 9:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.