Bỏ qua đến nội dung chính
Tất cả bộ sưu tậpAPITổng quan
Điện thoại đám mây kết nối ADB

Điện thoại đám mây kết nối ADB

Đã cập nhật cách đây hơn 3 tháng

1. Mở điện thoại đám mây ADB


def updateAdb():
requestPath = '/api/cloudphone/updateAdb'
data = {'ids': [156**********795], "enableAdb": 'true'}
headers = requestHeader()
headers['Content-Type'] ='application/json'
response = requests.post(BASEURL + requestPath, json=data, headers=headers)
print(response.content)


2. Kết nối và sử dụng ADB


  • Sau khi mở ADB, nhập "địa chỉ kết nối adb" trong giao diện nhắc lệnh để kết nối với địa chỉ đích. Sau khi đăng nhập thành công bằng mã kết nối, bạn có thể bắt đầu sử dụng ADB.

adb connect adbIp:adbPort

adb -s adbIp:adbPort shell zxlogin adbPasswrod

Để biết thông tin kết nối adb, vui lòng xem tài liệu API: Nhận danh sách các cấu hình điện thoại đám mây

  • Mã mẫu:

# -*- coding: utf-8 -*-
import os
import time
import datetime
import requests
import json

def click(device, x, y):
os.system("adb -s {} shell input tap {} {}".format(device, int(x), int(y)))


def swipe(device, start_x, start_y, end_x, end_y, duration=100):
os.system("adb -s {} shell input swipe {} {} {} {} {}".format(device, int(start_x), int(start_y), int(end_x), int(end_y), duration))


def launche_app(device, activity):
os.system("adb -s {} shell am start -n {}".format(device, activity))


def input_text(device, text):
os.system(r'adb -s {} shell "input text \"{}\""'.format(device, text))


def input_keyevent(device, keycode):
os.system('adb -s {} shell input keyevent {}'.format(device, int(keycode)))


def screenShootAndSave(device, localfilepath):
now = datetime.datetime.now()
file_name = "screecap_{}.png".format(now.strftime('%Y%m%d_%H%M%S'))
os.system("adb -s {} shell screencap -p /sdcard/{}".format(device, file_name))
time.sleep(1)
os.system("adb -s {} pull /sdcard/{} {}\{}".format(device, file_name, localfilepath, file_name))
time.sleep(1)
os.system('adb -s {} shell rm /sdcard/{}'.format(device, file_name))


3. Danh sách lệnh ADB


Bạn có thể bấm vào link dưới đây để xem:


Cần thêm trợ giúp? Vui lòng liên hệ với chúng tôi:


Nội dung này có giải đáp được câu hỏi của bạn không?