본문 바로가기

IT개발

(17)
안드로이드 화면 캡쳐하기 (코드에서) 안드로이드 개발자라면 기본적으로 디바이스의 화면을 DDMS에서 버튼 클릭으로 캡쳐가 가능하다는 사실을 알고 있을 것이다. 그건 그렇고… 소스 코드에서 캡쳐하는 방법은 없을까….. 여기 있다.. public void screenshot(View view)throws Exception { view.setDrawingCacheEnabled(true); Bitmap screenshot = view.getDrawingCache(); String filename = "screenshot.png"; try { File f = new File(Environment.getExternalStorageDirectory(), filename); f.createNewFile(); OutputStream outStream = n..
안드로이드 소스에서 shell 명령어 실행하기 안드로이드는 리눅스 기반이어서 adb shell을 실행하면 디바이스에서 실행되는 shell 모드로 들어가게 된다. 간단한 ls 명령어를 실행한 모습.. 그런데 소스 레벨에서 이런 명령어를 실행하고 싶을때가 있다. 특정 프로세스를 실행한다던가, 파일 입출력을 실행한다던가, 시스템 자원을 모니터링 한다던가… 아래는 top 명령어를 통해, 시스템 자원을 로그로 내보내는 간단한 코드 이다. Runtime runtime = Runtime.getRuntime(); Process process; String res = "-0-"; try { String cmd = "top -n 1"; process = runtime.exec(cmd); BufferedReader br = new BufferedReader(new In..
Android, low level shell click on screen Android, low level shell click on screen To send touch event you need to do: 1 Set coordinates: adb shell sendevent /dev/input/event2 3 0 x adb shell sendevent /dev/input/event2 3 1 y 2 Send touch event (must have 0 0 0 pair):adb shell sendevent /dev/input/event2 1 330 1 adb shell sendevent /dev/input/event2 0 0 0 3 Send release finger event (must have 0 0 0 pair):adb shell sendevent /dev/input/..
[Android] How to send key event by adb command [android-developers] Re: correct usage of "adb shell input" Madhusudhan K Tue, 02 Dec 2008 10:11:45 -0800 Hi You can use key codes directly like adb shell input keyevent 7 # for key '0' adb shell input keyevent 8 # for key '1' adb shell input keyevent 29 # for key 'A' adb shell input keyevent 54 # for key 'B' we can also send string as a text, like adb shell input text "ANDROID" The below text i..
안드로이드 키 이벤트 (adb shell로 보내는 법) Send key/mouse event using adb shell command. March 28, 2011 Two ways to send key event: 1 adb shell input keyevent KEY_CODE_XXX keycode can be found on developer.android.com eg. adb shell input keyevent 4 #send back key to target 2 adb shell sendevent [device] [type] adb shell sendevent /dev/input/event2 1 102 1 #home key down adb shell sendevent /dev/input/event2 1 102 0 #home key up must use ..
Android UI/Application Exerciser Monkey UI/Application Exerciser Monkey The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner. Overview The Monkey is a command-line tool that that you can ..
포트포워딩이란(Port forwarding)? 공유기쓰시면 한번쯤은 들어봤을 단어입니다. 포트포워딩 간단하게 개념을 설명해보겠습니다. 일단 공유기에는 외부아이피와 내부아이피가 존재합니다. 외부아이피는 외부에서 공유기에 접근하기 위한 아이피고, 내부아이피는 사설아이피, 즉 192.168.x.x 와 같이 공유기가 설치된 네트워크 안에서의 아이피죠. 밑에 그림에서처럼 외부에서 내컴퓨터로 접근하려면 먼저 123.123.123.123이라는 외부아이피로 공유기로 접근을 합니다.하지만 공유기까지 와봤자 외부접근은 내컴퓨터로 들어올수가 없습니다. 기본적으로 공유기에선 모든 외부 접근을 차단해버리기 때문이죠 이때 필요한게 '포트포워딩' 입니다. 즉, 공유기가 외부에서 들어온 접근을 원하는 곳으로 보내주는 것이죠. 이때 필요한게 내컴퓨터의 내부아이피와 외부내부 포트번..
안드로이드 ADB(Android Bebug Bridge)란? Android Debug Bridge http://developer.android.com/guide/developing/tools/adb.html ADB quickview Manage the state of an emulator or device Run shell commands on a device Manage port forwarding on an emulator or device - 포트포워딩에 대해 알고 싶다면? Copy files to/from an emulator or device In this document Issuing ADB Commands Querying for Emulator/Device Instances Directing Commands to a Specific Emulator/D..