使用裝置目錄,在開發人員裝置平台中尋找、排序及深入瞭解裝置。裝置目錄可協助您找出適合開發、測試及生產的目標裝置。
如需指令摘要,請參閱 gcloud beta device-run devices
list。
事前準備
這些步驟假設您已建立 Google Cloud 專案、完成「開發人員裝置平台快速入門」指南中的設定步驟,並在終端機中透過 gcloud 進行驗證。
在 Developer Device Platform 中列出裝置
列出 Google Cloud 專案中的裝置:
gcloud beta device-run devices list輸出內容是裝置清單,類似如下:
ID MAKE NAME MODEL FORM OS_VERSION CAPACITY AVAILABILITY PRODUCTS tegu-35 Google Pixel 9a tegu PHYSICAL 35 MEDIUM LOW Automation, Streaming tokay-34 Google Pixel 9 tokay PHYSICAL 34 HIGH HIGH Automation, Streaming tokay-35 Google Pixel 9 tokay PHYSICAL 35 HIGH HIGH Automation, Streaming tokay-36 Google Pixel 9 tokay PHYSICAL 36 MEDIUM MEDIUM Automation, Streaming從清單中找出適合您使用的裝置型號和作業系統版本,並擷取其 ID。
在 Developer Device Platform 中篩選裝置
如果您知道要使用的裝置型號和作業系統版本,可以篩選裝置清單,只顯示這些裝置。舉例來說,如要只列出作業系統版本為 35 的實體 Android 裝置,請執行下列指令:
gcloud beta device-run devices list --filter="HARDWARE_TYPE=PHYSICAL AND OS_VERSION=35 AND PLATFORM=ANDROID"輸出內容是符合篩選條件的裝置清單,例如:
ID MAKE NAME MODEL HARDWARE_TYPE OS_VERSION CAPACITY AVAILABILITY PRODUCTS re58c2-35 realme realme C53 RE58C2 PHYSICAL 35 NONE NONE Automation, Streaming tb370fu-35 Lenovo Lenovo Tab P12 TB370FU PHYSICAL 35 LOW LOW Automation a05s-35 Samsung Galaxy A05s a05s PHYSICAL 35 LOW LOW Automation, Streaming a06-35 Samsung Galaxy A06 a06 PHYSICAL 35 LOW LOW Automation, Streaming a14xmsq-35 Samsung Galaxy A14 5G a14xmsq PHYSICAL 35 LOW NONE Automation, Streaming a14xmtfn-35 Samsung Galaxy A14 5G a14xmtfn PHYSICAL 35 NONE NONE Automation, Streaming a16-35 Samsung Galaxy A16 a16 PHYSICAL 35 LOW LOW Automation, Streaming a16x-35 Samsung Galaxy A16 5G a16x PHYSICAL 35 LOW LOW Automation請記錄 ID,或繼續篩選清單,找出合適的裝置。
在 Developer Device Platform 中篩選及格式化裝置
除了篩選裝置,您也可以指定輸出格式:
gcloud beta device-run devices list --filter 'manufacturer=google AND formFactor=tablet' --format 'table(ID, AVAILABILITY)'輸出內容會列出符合篩選條件的裝置,並採用指定格式,例如:
ID AVAILABILITY tangorpro-33 HIGH tangorpro-36 MEDIUM擷取 ID,或繼續篩選及格式化清單,找出合適的裝置。
說明 Developer Device Platform 中的裝置
現在您已取得裝置清單,可以描述特定裝置,查看該裝置的詳細資訊:
gcloud beta device-run devices describe DEVICE_ID以
tokay-35為例,您會收到類似下列內容的輸出:availability: HIGH capacity: HIGH form: PHYSICAL formFactor: PHONE id: tokay-35 manufacturer: Google modelCode: tokay name: Pixel 9 platform: Android screenDensity: 420 screenX: 1080 screenY: 2424 supportedAbis: - arm64-v8a supportedProducts: - product: AUTOMATION - product: DEVICE_STREAMING根據這些詳細資料決定要使用的裝置和作業系統版本,並記下裝置 ID。
後續步驟
接著,使用這裡擷取的 ID,透過裝置執行作業開始執行測試。