명령어 레퍼런스
Droidline 전체 명령의 파라미터, 반환값, 에러와 Python, Node.js, CLI, HTTP에서의 같은 호출.
번역된 페이지입니다. 영어 문서와 내용이 다르면 영어 문서가 기준입니다. English
명령마다 하는 일, 파라미터, 반환값, 날 수 있는 에러를 보여 주고, 이어서 같은 호출을 인터페이스별로 보여 줍니다. 아무 예제에서나 언어를 고르면 페이지 전체가 그 언어로 바뀝니다. Python 예제는 d = connect()(서버 명령은 dl = Droidline())를, Node.js 예제는 const d = await connect()(const dl = new Droidline())를 이미 실행했다고 가정합니다.
화면
dump
현재 화면 노드 트리를 반환
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
path | string | 이 로컬 파일에 JSON으로 저장 | |
all_windows | bool | false | 상태 표시줄, 키보드 같은 시스템 창도 포함 |
반환: 다음 필드를 가진 객체: package, activity, width, height, tree
d.dump("screen.json") # saved on your PCawait d.dump("screen.json"); // saved on your PCdroidline dump screen.jsoncurl -s -X POST localhost:8780/devices/_/dump \
-H 'content-type: application/json' > screen.json{"id":1,"cmd":"dump"}screenshot
화면 캡처
Android 11 이상은 접근성 스크린샷, 9~10은 처음 한 번 화면 캡처 허용 팝업
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
path | string | 이 로컬 파일에 저장. 확장자로 png/jpeg 결정 | |
format | string png | jpeg | "jpeg" | 이미지 형식 |
quality | int | 80 | JPEG 품질 1~100 |
scale | number | 1 | 축소 비율 0.1~1.0, 모바일 데이터에서 유용 |
반환: 다음 필드를 가진 객체: format, width, height, data
d.screenshot("shot.png") # saved on your PCawait d.screenshot("shot.png"); // saved on your PCdroidline screenshot shot.pngcurl -s localhost:8780/devices/_/screenshot.png -o shot.png{"id":1,"cmd":"screenshot"}current
지금 떠 있는 패키지명과 액티비티명
반환: 다음 필드를 가진 객체: package, activity
d.current()await d.current();droidline currentcurl -s -X POST localhost:8780/devices/_/current \
-H 'content-type: application/json'{"id":1,"cmd":"current"}좌표
tap
좌표 탭
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x | int | 필수 | 화면 픽셀 X |
y | int | 필수 | 화면 픽셀 Y |
반환: 다음 필드를 가진 객체: ms
d.tap(540, 1200)await d.tap(540, 1200);droidline tap 540 1200curl -s -X POST localhost:8780/devices/_/tap \
-H 'content-type: application/json' \
-d '{"x":540,"y":1200}'{"id":1,"cmd":"tap","x":540,"y":1200}long_tap
좌표 길게 누르기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x | int | 필수 | 화면 픽셀 X |
y | int | 필수 | 화면 픽셀 Y |
ms | int | 800 | 누르는 시간(ms) |
반환: 다음 필드를 가진 객체: ms
d.long_tap(540, 1200, 800)await d.longTap(540, 1200, 800);droidline long_tap 540 1200 800curl -s -X POST localhost:8780/devices/_/long_tap \
-H 'content-type: application/json' \
-d '{"x":540,"y":1200,"ms":800}'{"id":1,"cmd":"long_tap","x":540,"y":1200,"ms":800}swipe
두 좌표 사이 또는 방향으로 스와이프
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x1 | int|string | 필수 | 시작 X 또는 방향: up, down, left, right |
y1 | int | 시작 Y | |
x2 | int | 끝 X | |
y2 | int | 끝 Y | |
ms | int | 300 | 시간(ms) |
반환: 다음 필드를 가진 객체: ms
d.swipe(540, 1600, 540, 400, 300)await d.swipe(540, 1600, 540, 400, 300);droidline swipe 540 1600 540 400 300curl -s -X POST localhost:8780/devices/_/swipe \
-H 'content-type: application/json' \
-d '{"x1":540,"y1":1600,"x2":540,"y2":400,"ms":300}'{"id":1,"cmd":"swipe","x1":540,"y1":1600,"x2":540,"y2":400,"ms":300}요소
touch
대상이 뜰 때까지 기다렸다가 누르기
노드 클릭이 거부되면 bounds 중심을 좌표 탭. via에 node, parent, gesture 중 성공한 경로 표시
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: via, ms
줄임 이름: touchById(value), touchByText(value), touchByDesc(value)
에러: NOT_FOUND, NOT_CLICKABLE, NO_ACCESSIBILITY
d.touch("text", "로그인")await d.touch("text", "로그인");droidline touch text "로그인"curl -s -X POST localhost:8780/devices/_/touch \
-H 'content-type: application/json' \
-d '{"by":"text","value":"로그인"}'{"id":1,"cmd":"touch","by":"text","value":"로그인"}long_touch
대상을 기다렸다가 길게 누르기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
ms | int | 800 | 누르는 시간(ms) |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: via, ms
d.long_touch("text", "메시지")await d.longTouch("text", "메시지");droidline long_touch text "메시지"curl -s -X POST localhost:8780/devices/_/long_touch \
-H 'content-type: application/json' \
-d '{"by":"text","value":"메시지"}'{"id":1,"cmd":"long_touch","by":"text","value":"메시지"}scroll_to
대상이 보일 때까지 스크롤
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
direction | string down | up | left | right | "down" | 스크롤 방향 |
max_swipes | int | 20 | 이만큼 스와이프해도 없으면 포기 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 필드를 가진 객체: swipes
d.scroll_to("text", "설정")await d.scrollTo("text", "설정");droidline scroll_to text "설정"curl -s -X POST localhost:8780/devices/_/scroll_to \
-H 'content-type: application/json' \
-d '{"by":"text","value":"설정"}'{"id":1,"cmd":"scroll_to","by":"text","value":"설정"}입력
input
입력칸을 기다렸다가 글자 넣기
접근성 글자 설정 동작을 쓰고, 이를 무시하는 칸은 자체 키보드가 선택돼 있으면 키보드로 입력
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
text | string | 필수 | 넣을 글자 |
append | bool | false | 기존 글자 뒤에 이어 붙이기 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: via, ms
d.input("id", "email", "me@example.com")await d.input("id", "email", "me@example.com");droidline input id email me@example.comcurl -s -X POST localhost:8780/devices/_/input \
-H 'content-type: application/json' \
-d '{"by":"id","value":"email","text":"me@example.com"}'{"id":1,"cmd":"input","by":"id","value":"email","text":"me@example.com"}clear
입력칸 비우기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: ms
d.clear("id", "email")await d.clear("id", "email");droidline clear id emailcurl -s -X POST localhost:8780/devices/_/clear \
-H 'content-type: application/json' \
-d '{"by":"id","value":"email"}'{"id":1,"cmd":"clear","by":"id","value":"email"}sendkey
키 이름, 키코드, 또는 글자 보내기
back, home, recents, notifications, quick_settings, lock은 접근성 전역 동작. 그 외 키와 글자는 자체 키보드로 포커스된 칸에 전송
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string|int | 키 이름(enter, tab, del, space, escape, up, down, left, right, back, home 등), 안드로이드 키코드, 또는 입력할 글자 | |
text | string | 키 이름과 같아도 글자 그대로 입력 |
반환: 다음 필드를 가진 객체: via
d.sendkey("enter")await d.sendkey("enter");droidline sendkey entercurl -s -X POST localhost:8780/devices/_/sendkey \
-H 'content-type: application/json' \
-d '{"key":"enter"}'{"id":1,"cmd":"sendkey","key":"enter"}확인
exists
지금 화면에 대상이 있는지. 기다리지 않음
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.exists("text", "광고 닫기")await d.exists("text", "광고 닫기");droidline exists text "광고 닫기"curl -s -X POST localhost:8780/devices/_/exists \
-H 'content-type: application/json' \
-d '{"by":"text","value":"광고 닫기"}'{"id":1,"cmd":"exists","by":"text","value":"광고 닫기"}wait
대상이 뜰 때까지 대기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 필드를 가진 객체: ms
에러: NOT_FOUND
d.wait("text", "완료", timeout=30)await d.wait("text", "완료", { timeout: 30 });droidline wait text "완료" --timeout 30curl -s -X POST localhost:8780/devices/_/wait \
-H 'content-type: application/json' \
-d '{"by":"text","value":"완료","timeout":30}'{"id":1,"cmd":"wait","by":"text","value":"완료","timeout":30}wait_gone
대상이 사라질 때까지 대기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: ms
에러: TIMEOUT
d.wait_gone("text", "불러오는 중")await d.waitGone("text", "불러오는 중");droidline wait_gone text "불러오는 중"curl -s -X POST localhost:8780/devices/_/wait_gone \
-H 'content-type: application/json' \
-d '{"by":"text","value":"불러오는 중"}'{"id":1,"cmd":"wait_gone","by":"text","value":"불러오는 중"}get_text
대상의 글자, 없으면 빈 문자열
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: string
d.get_text("id", "balance")await d.getText("id", "balance");droidline get_text id balancecurl -s -X POST localhost:8780/devices/_/get_text \
-H 'content-type: application/json' \
-d '{"by":"id","value":"balance"}'{"id":1,"cmd":"get_text","by":"id","value":"balance"}조건
checkedenabledselectedcountwhichin_appkeyboard_shownlast_toastcolor
checked
스위치·체크박스가 켜져 있으면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.checked("id", "auto_login")await d.checked("id", "auto_login");droidline checked id auto_logincurl -s -X POST localhost:8780/devices/_/checked \
-H 'content-type: application/json' \
-d '{"by":"id","value":"auto_login"}'{"id":1,"cmd":"checked","by":"id","value":"auto_login"}enabled
버튼이 눌릴 수 있는 상태면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.enabled("text", "다음")await d.enabled("text", "다음");droidline enabled text "다음"curl -s -X POST localhost:8780/devices/_/enabled \
-H 'content-type: application/json' \
-d '{"by":"text","value":"다음"}'{"id":1,"cmd":"enabled","by":"text","value":"다음"}selected
탭이 선택된 상태면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.selected("text", "홈")await d.selected("text", "홈");droidline selected text "홈"curl -s -X POST localhost:8780/devices/_/selected \
-H 'content-type: application/json' \
-d '{"by":"text","value":"홈"}'{"id":1,"cmd":"selected","by":"text","value":"홈"}count
조건에 맞는 요소 개수
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지: text, textContains, id, desc, descContains, class |
value | string | 필수 | 찾을 값 |
반환: 다음 타입의 값: int
d.count("class", "android.widget.CheckBox")await d.count("class", "android.widget.CheckBox");droidline count class android.widget.CheckBoxcurl -s -X POST localhost:8780/devices/_/count \
-H 'content-type: application/json' \
-d '{"by":"class","value":"android.widget.CheckBox"}'{"id":1,"cmd":"count","by":"class","value":"android.widget.CheckBox"}which
여러 후보 중 먼저 나타난 것의 순번, 없으면 -1
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
candidates | list<selector_pair> | 필수 | [속성, 값] 쌍의 목록 |
timeout | number | 10 s | 후보가 뜰 때까지 기다리는 초 |
반환: 다음 타입의 값: int
d.which([("text", "로그인"), ("id", "main_tab")], timeout=15)await d.which([["text", "로그인"], ["id", "main_tab"]], { timeout: 15 });droidline which text="로그인" id=main_tab --timeout 15curl -s -X POST localhost:8780/devices/_/which \
-H 'content-type: application/json' \
-d '{"candidates":[["text","로그인"],["id","main_tab"]],"timeout":15}'{"id":1,"cmd":"which","candidates":[["text","로그인"],["id","main_tab"]],"timeout":15}in_app
지금 그 앱이 앞에 떠 있으면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 타입의 값: bool
d.in_app("com.android.chrome")await d.inApp("com.android.chrome");droidline in_app com.android.chromecurl -s -X POST localhost:8780/devices/_/in_app \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"in_app","package":"com.android.chrome"}keyboard_shown
키보드가 올라와 있으면 true
반환: 다음 타입의 값: bool
d.keyboard_shown()await d.keyboardShown();droidline keyboard_showncurl -s -X POST localhost:8780/devices/_/keyboard_shown \
-H 'content-type: application/json'{"id":1,"cmd":"keyboard_shown"}last_toast
최근 토스트 메시지 글자, 없으면 빈 문자열
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
max_age | number | 30 s | 이 초보다 오래된 토스트는 무시 |
반환: 다음 타입의 값: string
d.last_toast()await d.lastToast();droidline last_toastcurl -s -X POST localhost:8780/devices/_/last_toast \
-H 'content-type: application/json'{"id":1,"cmd":"last_toast"}color
해당 좌표의 색(#RRGGBB)
노드가 없는 화면(게임 등) 분기용
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x | int | 필수 | 화면 픽셀 X |
y | int | 필수 | 화면 픽셀 Y |
반환: 다음 타입의 값: string
d.color(540, 1200)await d.color(540, 1200);droidline color 540 1200curl -s -X POST localhost:8780/devices/_/color \
-H 'content-type: application/json' \
-d '{"x":540,"y":1200}'{"id":1,"cmd":"color","x":540,"y":1200}기기
screen_onlockedwakelockbatteryorientationinfo
screen_on
화면이 켜져 있으면 true
반환: 다음 타입의 값: bool
d.screen_on()await d.screenOn();droidline screen_oncurl -s -X POST localhost:8780/devices/_/screen_on \
-H 'content-type: application/json'{"id":1,"cmd":"screen_on"}locked
잠금 화면이면 true
반환: 다음 타입의 값: bool
d.locked()await d.locked();droidline lockedcurl -s -X POST localhost:8780/devices/_/locked \
-H 'content-type: application/json'{"id":1,"cmd":"locked"}wake
화면을 켜고, PIN이 없는 잠금 화면은 해제
화면이 꺼져 있으면 제스처가 실패합니다. PIN·패턴·비밀번호 잠금은 사람이 풀어야 합니다
반환: 다음 필드를 가진 객체: screen_on, locked
d.wake()await d.wake();droidline wakecurl -s -X POST localhost:8780/devices/_/wake \
-H 'content-type: application/json'{"id":1,"cmd":"wake"}lock
화면 끄고 잠그기
반환: 없음
d.lock()await d.lock();droidline lockcurl -s -X POST localhost:8780/devices/_/lock \
-H 'content-type: application/json'{"id":1,"cmd":"lock"}battery
배터리 잔량, 충전 중 여부
반환: 다음 필드를 가진 객체: level, charging, temperature
d.battery()await d.battery();droidline batterycurl -s -X POST localhost:8780/devices/_/battery \
-H 'content-type: application/json'{"id":1,"cmd":"battery"}orientation
화면 방향: portrait 또는 landscape
반환: 다음 타입의 값: string
d.orientation()await d.orientation();droidline orientationcurl -s -X POST localhost:8780/devices/_/orientation \
-H 'content-type: application/json'{"id":1,"cmd":"orientation"}info
모델, 안드로이드 버전, 화면 크기, 권한 준비 상태
반환: 다음 필드를 가진 객체: model, manufacturer, sdk, release, agent, width, height, ready
d.info()await d.info();droidline infocurl -s -X POST localhost:8780/devices/_/info \
-H 'content-type: application/json'{"id":1,"cmd":"info"}네트워크
network
연결 종류(wifi, mobile, none)와 비행기 모드 여부
반환: 다음 필드를 가진 객체: type, airplane, metered
d.network()await d.network();droidline networkcurl -s -X POST localhost:8780/devices/_/network \
-H 'content-type: application/json'{"id":1,"cmd":"network"}proxy
앱별 VPN으로 고른 앱만 업스트림 프록시로 보내기
http://(CONNECT)와 socks5://, user:pass 인증 지원. null이나 "off"로 끔. 업스트림은 한 번에 하나. 프록시 설정을 무시하는 앱은 새지 않고 연결이 막힘
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
url | string|null | 필수 | socks5://user:pass@host:port, http://host:port, @kr1 같은 저장된 프로필, 또는 off |
app | string|list<string> | 프록시로 보낼 패키지(여러 개 가능) |
반환: 다음 필드를 가진 객체: active, apps
에러: NO_PERMISSION, PROXY_FAILED, UNSUPPORTED
d.proxy("@kr1", app="com.android.chrome")await d.proxy("@kr1", { app: "com.android.chrome" });droidline proxy @kr1 --app com.android.chromecurl -s -X POST localhost:8780/devices/_/proxy \
-H 'content-type: application/json' \
-d '{"url":"@kr1","app":"com.android.chrome"}'{"id":1,"cmd":"proxy","url":"@kr1","app":"com.android.chrome"}proxy_check
앱별 프록시 연결 상태와 바깥에서 보이는 IP
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
app | string | 확인할 패키지 |
반환: 다음 필드를 가진 객체: active, ip, upstream, error
d.proxy_check("com.android.chrome")await d.proxyCheck("com.android.chrome");droidline proxy_check com.android.chromecurl -s -X POST localhost:8780/devices/_/proxy_check \
-H 'content-type: application/json' \
-d '{"app":"com.android.chrome"}'{"id":1,"cmd":"proxy_check","app":"com.android.chrome"}앱
launchopen_urlkillclear_dataappsinstalled
launch
앱 실행, 선택적으로 특정 액티비티
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
activity | string | 액티비티명, 전체 이름 또는 점으로 시작 |
반환: 다음 필드를 가진 객체: ms
에러: APP_NOT_FOUND, ACTIVITY_BLOCKED
d.launch("com.android.settings")await d.launch("com.android.settings");droidline launch com.android.settingscurl -s -X POST localhost:8780/devices/_/launch \
-H 'content-type: application/json' \
-d '{"package":"com.android.settings"}'{"id":1,"cmd":"launch","package":"com.android.settings"}open_url
URL이나 딥링크 열기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
url | string | 필수 | http(s) 주소 또는 앱 딥링크 |
package | string | 이 앱으로만 열기 |
반환: 없음
d.open_url("https://droidline.dev")await d.openUrl("https://droidline.dev");droidline open_url https://droidline.devcurl -s -X POST localhost:8780/devices/_/open_url \
-H 'content-type: application/json' \
-d '{"url":"https://droidline.dev"}'{"id":1,"cmd":"open_url","url":"https://droidline.dev"}kill
앱 강제 종료
설정 매크로: 앱 정보 → 강제 중지 → 확인. 몇 초 소요
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 필드를 가진 객체: via, ms
에러: APP_NOT_FOUND, MACRO_FAILED
d.kill("com.android.chrome")await d.kill("com.android.chrome");droidline kill com.android.chromecurl -s -X POST localhost:8780/devices/_/kill \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"kill","package":"com.android.chrome"}clear_data
앱 데이터 삭제
설정 매크로: 앱 정보 → 저장공간 → 데이터 삭제 → 확인
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 필드를 가진 객체: via, ms
에러: APP_NOT_FOUND, MACRO_FAILED
d.clear_data("com.android.chrome")await d.clearData("com.android.chrome");droidline clear_data com.android.chromecurl -s -X POST localhost:8780/devices/_/clear_data \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"clear_data","package":"com.android.chrome"}apps
설치된 패키지 목록
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
system | bool | false | 시스템 패키지 포함 |
반환: 다음 타입의 값: list<app>
d.apps()await d.apps();droidline appscurl -s -X POST localhost:8780/devices/_/apps \
-H 'content-type: application/json'{"id":1,"cmd":"apps"}installed
설치돼 있으면 버전명, 아니면 빈 문자열
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 타입의 값: string
d.installed("com.android.chrome")await d.installed("com.android.chrome");droidline installed com.android.chromecurl -s -X POST localhost:8780/devices/_/installed \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"installed","package":"com.android.chrome"}시스템
backhomerecentsopen_notificationsquick_settingsdatawifiairplaneclipboardbatch
back
뒤로
반환: 없음
d.back()await d.back();droidline backcurl -s -X POST localhost:8780/devices/_/back \
-H 'content-type: application/json'{"id":1,"cmd":"back"}home
홈 화면
반환: 없음
d.home()await d.home();droidline homecurl -s -X POST localhost:8780/devices/_/home \
-H 'content-type: application/json'{"id":1,"cmd":"home"}recents
최근 앱
반환: 없음
d.recents()await d.recents();droidline recentscurl -s -X POST localhost:8780/devices/_/recents \
-H 'content-type: application/json'{"id":1,"cmd":"recents"}open_notifications
알림창 내리기
반환: 없음
d.open_notifications()await d.openNotifications();droidline open_notificationscurl -s -X POST localhost:8780/devices/_/open_notifications \
-H 'content-type: application/json'{"id":1,"cmd":"open_notifications"}quick_settings
빠른 설정 열기
반환: 없음
d.quick_settings()await d.quickSettings();droidline quick_settingscurl -s -X POST localhost:8780/devices/_/quick_settings \
-H 'content-type: application/json'{"id":1,"cmd":"quick_settings"}data
모바일 데이터 끄기·켜기
폰 자신의 연결을 끊는 명령입니다. 먼저 accepted로 답하며, wait를 주면 최종 결과를 받습니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
on | bool | 필수 | true면 켜기, false면 끄기 |
반환: 다음 필드를 가진 객체: via, ms
에러: MACRO_FAILED
d.data(False, wait=True)await d.data(false, { wait: true });droidline data false --waitcurl -s -X POST localhost:8780/devices/_/data \
-H 'content-type: application/json' \
-d '{"wait":true,"on":false}'{"id":1,"cmd":"data","on":false,"wait":true}wifi
와이파이 끄기·켜기
폰 자신의 연결을 끊는 명령입니다. 먼저 accepted로 답하며, wait를 주면 최종 결과를 받습니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
on | bool | 필수 | true면 켜기, false면 끄기 |
반환: 다음 필드를 가진 객체: via, ms
에러: MACRO_FAILED
d.wifi(False, wait=True)await d.wifi(false, { wait: true });droidline wifi false --waitcurl -s -X POST localhost:8780/devices/_/wifi \
-H 'content-type: application/json' \
-d '{"wait":true,"on":false}'{"id":1,"cmd":"wifi","on":false,"wait":true}airplane
비행기 모드 켜기·끄기
IP 갱신은 켜기·끄기를 batch 하나로 묶어야 폰이 끊긴 동안에도 둘 다 실행합니다
폰 자신의 연결을 끊는 명령입니다. 먼저 accepted로 답하며, wait를 주면 최종 결과를 받습니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
on | bool | 필수 | true면 켜기, false면 끄기 |
반환: 다음 필드를 가진 객체: via, ms
에러: MACRO_FAILED
d.airplane(True, wait=True)await d.airplane(true, { wait: true });droidline airplane true --waitcurl -s -X POST localhost:8780/devices/_/airplane \
-H 'content-type: application/json' \
-d '{"wait":true,"on":true}'{"id":1,"cmd":"airplane","on":true,"wait":true}clipboard
클립보드 쓰기, 글자 없이 부르면 읽기
Android 10 이상에서 읽기는 자체 키보드가 현재 입력기여야 가능
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
text | string | 복사할 글. 생략하면 읽기 |
반환: 다음 타입의 값: string
에러: NO_IME
d.clipboard("안녕하세요")await d.clipboard("안녕하세요");droidline clipboard "안녕하세요"curl -s -X POST localhost:8780/devices/_/clipboard \
-H 'content-type: application/json' \
-d '{"text":"안녕하세요"}'{"id":1,"cmd":"clipboard","text":"안녕하세요"}batch
여러 명령을 폰에서 한 번에 실행, 끊긴 동안에도 계속
단계는 [명령, 인자...] 목록이나 {cmd, ...} 객체. sleep(ms)는 batch 안에서만 씀. 망을 끊는 단계가 있으면 accepted로 먼저 답하고 재접속 후 결과가 옴
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
steps | list<step> | 필수 | 순서대로 실행할 명령 |
stop_on_error | bool | true | 실패한 단계에서 멈춤 |
반환: 다음 필드를 가진 객체: results
d.batch([("airplane", True), ("sleep", 3000), ("airplane", False)], wait=True)await d.batch([["airplane", true], ["sleep", 3000], ["airplane", false]], { wait: true });droidline batch '[["airplane",true],["sleep",3000],["airplane",false]]' --waitcurl -s -X POST localhost:8780/devices/_/batch \
-H 'content-type: application/json' \
-d '{"wait":true,"steps":[["airplane",true],["sleep",3000],["airplane",false]]}'{"id":1,"cmd":"batch","steps":[["airplane",true],["sleep",3000],["airplane",false]],"wait":true}크롬
chrome.go
크롬에서 주소 열기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
url | string | 필수 | 주소. https://가 없으면 붙임 |
new_tab | bool | false | 새 탭에서 열기 |
반환: 다음 필드를 가진 객체: ms
에러: APP_NOT_FOUND
d.chrome.go("droidline.dev")await d.chrome.go("droidline.dev");droidline chrome.go droidline.devcurl -s -X POST localhost:8780/devices/_/chrome.go \
-H 'content-type: application/json' \
-d '{"url":"droidline.dev"}'{"id":1,"cmd":"chrome.go","url":"droidline.dev"}알림
notificationshas_notificationwait_notificationnotification_replynotification_clicknotification_dismissnotify_filteron_notification
notifications
지금 떠 있는 알림 목록
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 이 앱만 |
반환: 다음 타입의 값: list<notification>
d.notifications()await d.notifications();droidline notificationscurl -s -X POST localhost:8780/devices/_/notifications \
-H 'content-type: application/json'{"id":1,"cmd":"notifications"}has_notification
지금 떠 있는 알림 중 조건에 맞는 게 있으면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | string text | textContains | title | package | 필수 | text, textContains는 제목과 본문 모두에서 찾음 |
value | string | 필수 | 찾을 값 |
반환: 다음 타입의 값: bool
d.has_notification("textContains", "배송")await d.hasNotification("textContains", "배송");droidline has_notification textContains "배송"curl -s -X POST localhost:8780/devices/_/has_notification \
-H 'content-type: application/json' \
-d '{"by":"textContains","value":"배송"}'{"id":1,"cmd":"has_notification","by":"textContains","value":"배송"}wait_notification
조건에 맞는 알림이 오면 내용 반환
PC 서버가 처리하므로 폰의 다른 명령을 막지 않습니다. Android 15 이상은 인증번호를 가려서 넘기므로 알림 도착만 알 수 있습니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | string text | textContains | title | package | 필수 | text, textContains는 제목과 본문 모두에서 찾음 |
value | string | 필수 | 찾을 값 |
timeout | number | 60 s | 기다리는 초 |
package | string | 이 앱에서 온 것만 |
반환: 다음 타입의 값: notification
에러: TIMEOUT
dl.wait_notification("textContains", "인증번호", 60)await dl.waitNotification("textContains", "인증번호", 60);droidline wait_notification textContains "인증번호" 60curl -s -X POST localhost:8780/server/wait_notification \
-H 'content-type: application/json' \
-d '{"by":"textContains","value":"인증번호","timeout":60}'{"id":1,"cmd":"wait_notification","by":"textContains","value":"인증번호","timeout":60}notification_reply
답장 버튼이 있는 알림에 바로 답장
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string | 필수 | notifications() 또는 알림 이벤트의 key |
text | string | 필수 | 답장 글 |
반환: 없음
n = d.notifications()[0]
d.notification_reply(n["key"], "가는 중이에요")const [n] = await d.notifications();
await d.notificationReply(n.key, "가는 중이에요");KEY=$(droidline --json notifications | jq -r '.value[0].key')
droidline notification_reply "$KEY" "가는 중이에요"curl -s -X POST localhost:8780/devices/_/notification_reply \
-H 'content-type: application/json' \
-d '{"key":"KEY","text":"가는 중이에요"}'{"id":1,"cmd":"notification_reply","key":"KEY","text":"가는 중이에요"}notification_click
알림을 눌러 해당 화면 열기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string | 필수 | notifications() 또는 알림 이벤트의 key |
반환: 없음
n = d.notifications()[0]
d.notification_click(n["key"])const [n] = await d.notifications();
await d.notificationClick(n.key);KEY=$(droidline --json notifications | jq -r '.value[0].key')
droidline notification_click "$KEY"curl -s -X POST localhost:8780/devices/_/notification_click \
-H 'content-type: application/json' \
-d '{"key":"KEY"}'{"id":1,"cmd":"notification_click","key":"KEY"}notification_dismiss
알림 지우기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string | 필수 | notifications() 또는 알림 이벤트의 key |
반환: 없음
n = d.notifications()[0]
d.notification_dismiss(n["key"])const [n] = await d.notifications();
await d.notificationDismiss(n.key);KEY=$(droidline --json notifications | jq -r '.value[0].key')
droidline notification_dismiss "$KEY"curl -s -X POST localhost:8780/devices/_/notification_dismiss \
-H 'content-type: application/json' \
-d '{"key":"KEY"}'{"id":1,"cmd":"notification_dismiss","key":"KEY"}notify_filter
PC로 보낼 알림 앱 고르기. 기본값은 아무 앱도 보내지 않음
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
packages | list<string> | 허용할 패키지. 생략하면 현재 목록 조회 |
반환: 다음 타입의 값: list<string>
d.notify_filter(["com.android.chrome", "com.google.android.gm"])await d.notifyFilter(["com.android.chrome", "com.google.android.gm"]);droidline notify_filter com.android.chrome,com.google.android.gmcurl -s -X POST localhost:8780/devices/_/notify_filter \
-H 'content-type: application/json' \
-d '{"packages":["com.android.chrome","com.google.android.gm"]}'{"id":1,"cmd":"notify_filter","packages":["com.android.chrome","com.google.android.gm"]}on_notification
조건에 맞는 알림마다 함수 호출
SDK 전용, subscribe 위에 구현. CLI는 맞는 알림을 JSON 줄로 출력
SDK 안에서 동작합니다. 서버에는 subscribe 줄이 갑니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 이 앱에서 온 것만 | |
textContains | string | 제목이나 본문에 이 글이 있을 때만 |
반환: 없음
stop = d.on_notification(package="com.google.android.gm", callback=print)
# ... later
stop()const stop = await d.onNotification({ package: "com.google.android.gm" }, (n) => console.log(n.title, n.text));
// ... later
stop();droidline on_notification --package com.google.android.gm{"id":1,"cmd":"subscribe","events":["notification"]}서버
devicespairpair_qrrenamerevokesubscribeserver_infoauth
devices
등록된 기기와 온라인 상태, 접속 경로
반환: 다음 타입의 값: list<device>
dl.devices()await dl.devices();droidline devicescurl -s localhost:8780/devices{"id":1,"cmd":"devices"}pair
이 6자리 코드를 띄운 폰을 등록
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
code | string | 필수 | 폰에 표시된 코드 |
name | string | 기기에 붙일 이름 |
반환: 다음 타입의 값: device
에러: PAIRING_FAILED
dl.pair("482913", name="shelf-01")await dl.pair("482913", { name: "shelf-01" });droidline pair 482913 --name shelf-01curl -s -X POST localhost:8780/server/pair \
-H 'content-type: application/json' \
-d '{"code":"482913","name":"shelf-01"}'{"id":1,"cmd":"pair","code":"482913","name":"shelf-01"}pair_qr
10분 동안 유효한 일회용 페어링 QR 만들기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
name | string | 기기에 붙일 이름 |
반환: 다음 필드를 가진 객체: uri, expires
dl.pair_qr()await dl.pairQr();droidline pair # shows the QR code in the terminalcurl -s -X POST localhost:8780/server/pair_qr \
-H 'content-type: application/json'{"id":1,"cmd":"pair_qr"}rename
기기 이름 바꾸기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
device | string | 필수 | 기기 ID 또는 이름 |
name | string | 필수 | 새 이름 |
반환: 다음 타입의 값: device
dl.rename("k7d2q9xa", "shelf-01")await dl.rename("k7d2q9xa", "shelf-01");droidline rename k7d2q9xa shelf-01curl -s -X POST localhost:8780/server/rename \
-H 'content-type: application/json' \
-d '{"device":"k7d2q9xa","name":"shelf-01"}'{"id":1,"cmd":"rename","device":"k7d2q9xa","name":"shelf-01"}revoke
기기 등록 폐기. 다시 페어링해야 접속 가능
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
device | string | 필수 | 기기 ID 또는 이름 |
반환: 없음
dl.revoke("shelf-01")await dl.revoke("shelf-01");droidline revoke shelf-01curl -s -X POST localhost:8780/server/revoke \
-H 'content-type: application/json' \
-d '{"device":"shelf-01"}'{"id":1,"cmd":"revoke","device":"shelf-01"}subscribe
이 연결로 이벤트 받기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
events | list<string> | 필수 | notification, screen, toast, device, result 중에서 |
device | string | 이 기기 것만. 생략하면 전체 |
반환: 없음
dl.subscribe(["notification"])await dl.subscribe(["notification"]);{"id":1,"cmd":"subscribe","events":["notification"]}server_info
서버 버전, 포트, 대기 주소
반환: 다음 필드를 가진 객체: version, server, name, proto, agent_port, client_port
dl.server_info()await dl.serverInfo();droidline server_infocurl -s -X POST localhost:8780/server/server_info \
-H 'content-type: application/json'{"id":1,"cmd":"server_info"}auth
이 클라이언트 연결을 토큰으로 인증
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
token | string | 필수 | droidline token으로 만든 클라이언트 토큰 |
반환: 없음
dl.auth("your-client-token")await dl.auth("your-client-token");{"id":1,"cmd":"auth","token":"your-client-token"}