Programmatic screencapture on mobile device

前端 未结 6 1312
無奈伤痛
無奈伤痛 2020-11-28 07:50

I would like to implement some sort of remote assistance tool (like vnc) for Android. Is there the possibility to capture a screen programmatically on the device?

6条回答
  •  醉酒成梦
    2020-11-28 08:25

    There is a long discussion of this on android-developers, but the short answer is: You can't programatically take a screenshot of an android device's screen at the moment, unless

    1. You have root access on that phone, or
    2. Your application is a system application

    The Android Manifest permission READ_FRAME_BUFFER exists (see the api docs here), but can presently only be used by system applications. There are various reasons for this, one being that it is a security risk. If an background can take a screenshot of the phone's screen at any time, then people could use OCR techniques to sniff user's passwords as they were typed in, among other private information.

    So no, a VNC application is not possible at the moment without root. To take a screenshot from your computer (while the phone is plugged in via usb) you can use DDMS.

提交回复
热议问题