Devices

如需本資源的方法清單,請見本頁結尾。

資源表示法

裝置資源代表由 EMM 管理,並屬於特定企業使用者的行動裝置。

{
  "kind": "androidenterprise#device",
  "androidId": string,
  "managementType": string,
  "policy": {
    "autoUpdatePolicy": string,
    "productAvailabilityPolicy": string,
    "productPolicy": [
      {
        "productId": string,
        "tracks": [
          string
        ],
        "trackIds": [
          string
        ],
        "managedConfiguration": {
          "kind": string,
          "productId": string,
          "managedProperty": [
            {
              "key": string,
              "valueBool": boolean,
              "valueInteger": integer,
              "valueString": string,
              "valueStringArray": [
                string
              ],
              "valueBundle": {
                "managedProperty": [
                  (ManagedProperty)
                ]
              },
              "valueBundleArray": [
                {
                  "managedProperty": [
                    (ManagedProperty)
                  ]
                }
              ]
            }
          ],
          "configurationVariables": {
            "kind": "androidenterprise#configurationVariables",
            "mcmId": string,
            "variableSet": [
              {
                "kind": "androidenterprise#variableSet",
                "placeholder": string,
                "userValue": string
              }
            ]
          }
        },
        "autoInstallPolicy": {
          "autoInstallMode": string,
          "autoInstallPriority": integer,
          "autoInstallConstraint": [
            {
              "networkTypeConstraint": string,
              "chargingStateConstraint": string,
              "deviceIdleStateConstraint": string
            }
          ],
          "minimumVersionCode": integer
        },
        "autoUpdateMode": string,
        "enterpriseAuthenticationAppLinkConfigs": [
          {
            "uri": string
          }
        ]
      }
    ],
    "maintenanceWindow": {
      "startTimeAfterMidnightMs": long,
      "durationMs": long
    },
    "deviceReportPolicy": string
  },
  "report": {
    "lastUpdatedTimestampMillis": long,
    "appState": [
      {
        "packageName": string,
        "keyedAppState": [
          {
            "key": string,
            "stateTimestampMillis": long,
            "severity": string,
            "message": string,
            "data": string
          }
        ]
      }
    ]
  },
  "latestBuildFingerprint": string,
  "sdkVersion": integer,
  "maker": string,
  "model": string,
  "device": string,
  "product": string,
  "retailBrand": string
}
資源名稱 說明 Notes
androidId string 裝置的 Google Play 服務 Android ID (編碼為小寫十六進位字串)。例如 "123456789abcdef0"
device string 裝置的內部硬體代碼名稱。這項資訊來自 android.os.Build.DEVICE。(每個記錄/wireless/android/android_checkin.proto 命名為「device」的欄位)
kind string
latestBuildFingerprint string 裝置的版本指紋 (如果已知)。
maker string 裝置製造商。這項資訊來自 android.os.Build.MANUFACTURER
managementType string 用於識別裝置在各種部署設定中,由 Google Play 管理版 EMM 控管的程度。

可能的值包括:
  • managedDevice」,表示裝置擁有者使用 EMM 的裝置政策控制器 (DPC)。
  • managedProfile」:裝置擁有由 DPC 管理的設定檔 (DPC 是設定檔擁有者),同時也是 DPC 無法存取的獨立個人設定檔。
  • containerApp」,已不再使用 (已淘汰)。
  • unmanagedProfile」:該裝置已允許 (網域管理員透過管理控制台啟用權限) 使用 Google Play 管理版,但該設定檔並非 DPC 所擁有的裝置。


可接受的值如下:
  • "containerApp"
  • "managedDevice"
  • "managedProfile"
  • "unmanagedProfile"
model string 裝置的型號名稱。這項資訊來自 android.os.Build.MODEL
policy nested object 裝置強制執行的政策。
policy.autoUpdatePolicy string 控管可在裝置上套用應用程式自動更新的時機。

建議替代方案:每個應用程式設定 autoUpdateMode,對更新頻率更有彈性。

autoUpdateMode 設為 AUTO_UPDATE_POSTPONEDAUTO_UPDATE_HIGH_PRIORITY 時,autoUpdatePolicy 不會有任何作用。

「choiceToTheUser」可讓使用者設定應用程式更新政策。「一律」會啟用自動更新。如果設為「永不」,系統會停用自動更新功能。啟用「wifiOnly」即可啟用自動更新功能,但裝置必須連上 Wi-Fi。

可接受的值如下:
  • "always"
  • "choiceToTheUser"
  • "never"
  • "wifiOnly"
policy.deviceReportPolicy string 指定裝置是否向 EMM 回報應用程式狀態。預設值為「deviceReportDisabled」。

可接受的值如下:
  • "deviceReportDisabled"
  • "deviceReportEnabled"
policy.maintenanceWindow nested object 維護期間,定義在前景執行的應用程式應更新的時間。
policy.maintenanceWindow.durationMs long 維護期間的持續時間 (以毫秒為單位)。時間長度必須介於 30 分鐘至 24 小時之間 (含首尾)。
policy.maintenanceWindow.startTimeAfterMidnightMs long 維護期間的開始時間,從裝置午夜開始,以毫秒為單位。視窗可以橫跨午夜。
policy.productAvailabilityPolicy string 已授予指定產品的裝置供應情形。無論核准狀態為何,「全部」選項會讓裝置存取所有產品。「全部」不會自動顯示「Alpha 版」或「Beta 版」測試群組。「白名單」可讓裝置存取 productPolicy[] 中指定的產品。只有已核准的產品或先前核准的產品 (經撤銷核准的產品) 才能加入許可清單。如未提供任何值,系統會預設套用使用者層級設定的供應情形。

可接受的值如下:
  • "all"
  • "whitelist"
policy.productPolicy[] list 產品政策清單。productAvailabilityPolicy 必須設為 WHITELISTALL,才能套用產品政策。
policy.productPolicy[].autoInstallPolicy nested object 產品的自動安裝政策。
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[] list 自動安裝應用程式的限制。您最多可以指定一項限制。

policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].chargingStateConstraint string 充電狀態限制。

可接受的值如下:
  • "chargingNotRequired"
  • "chargingRequired"
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].deviceIdleStateConstraint string 裝置閒置狀態限制。

可接受的值如下:
  • "deviceIdleNotRequired"
  • "deviceIdleRequired"
policy.productPolicy[].autoInstallPolicy.autoInstallConstraint[].networkTypeConstraint string 網路類型限制。

可接受的值如下:
  • "anyNetwork"
  • "unmeteredNetwork"
policy.productPolicy[].autoInstallPolicy.autoInstallMode string 自動安裝模式。如未設定,則預設為「doNotAutoInstall」。無論設定的維護期間為何,系統都會自動安裝應用程式。

可接受的值如下:
  • "autoInstallOnce"
  • "doNotAutoInstall"
  • "forceAutoInstall"
policy.productPolicy[].autoInstallPolicy.autoInstallPriority integer 安裝的優先順序,為未簽署的整數。數字越小表示優先順序越高。
policy.productPolicy[].autoInstallPolicy.minimumVersionCode integer 應用程式的最低版本。如果已安裝較舊版本的應用程式,則會根據自動更新限制自動更新應用程式,而不是等待一般自動更新。每個裝置最多只能為 20 個應用程式設定最低版本代碼。
policy.productPolicy[].autoUpdateMode string 產品的自動更新模式。使用 autoUpdateMode 時,其優先順序一律高於使用者所選的設定。因此,當使用者手動變更裝置設定時,系統就會忽略這些變更。

可接受的值如下:
  • "autoUpdateDefault"
  • "autoUpdateHighPriority"
  • "autoUpdatePostponed"
policy.productPolicy[].enterpriseAuthenticationAppLinkConfigs[] list 識別資訊提供者驗證器應用程式的驗證網址設定。這有助於在使用 Android WebView 的私人應用程式中進行驗證時,啟動識別資訊提供者的驗證器應用程式。Authenticator 應用程式應該已經是裝置上驗證網址的 預設處理常式
policy.productPolicy[].enterpriseAuthenticationAppLinkConfigs[].uri string 驗證網址。
policy.productPolicy[].managedConfiguration nested object 產品的受管理設定。
policy.productPolicy[].managedConfiguration.configurationVariables nested object 包含受管理組態設定檔的 ID,以及為使用者定義的一組設定變數 (如果有的話)。
policy.productPolicy[].managedConfiguration.configurationVariables.kind string
policy.productPolicy[].managedConfiguration.configurationVariables.mcmId string 受管理設定的 ID。
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[] list 歸因於使用者的變數組合。
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[].kind string
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[].placeholder string 預留位置字串;由 EMM 定義。
policy.productPolicy[].managedConfiguration.configurationVariables.variableSet[].userValue string 使用者專屬的預留位置值。
policy.productPolicy[].managedConfiguration.kind string 已淘汰。

policy.productPolicy[].managedConfiguration.managedProperty[] list 這項設定的一組受管理屬性。
policy.productPolicy[].managedConfiguration.managedProperty[].key string 識別屬性的專屬金鑰。
policy.productPolicy[].managedConfiguration.managedProperty[].valueBool boolean 布林值 - 只有在屬性類型為布林值時才會顯示。
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundle nested object 受管理資源組合 - 只有在資源類型為套裝組合時才會顯示。
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundle.managedProperty[] list 代管資源清單。
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundleArray[] list 屬性組合清單 - 只有在屬性類型為 bundle_array 時,才會顯示此屬性。
policy.productPolicy[].managedConfiguration.managedProperty[].valueBundleArray[].managedProperty[] list 代管資源清單。
policy.productPolicy[].managedConfiguration.managedProperty[].valueInteger integer 整數值 - 只有在屬性類型為整數時才會顯示。
policy.productPolicy[].managedConfiguration.managedProperty[].valueString string 字串值 - 只有在屬性類型為字串、選擇或隱藏時才會顯示此項目。
policy.productPolicy[].managedConfiguration.managedProperty[].valueStringArray[] list 字串值清單 - 屬性類型為複選時才會顯示。
policy.productPolicy[].managedConfiguration.productId string 受管理設定的產品 ID,例如「app:com.google.android.gm」。
policy.productPolicy[].productId string 產品的 ID。例如 "app:com.google.android.gm"
policy.productPolicy[].trackIds[] list 將裝置瀏覽權限授予指定的產品測試群組(可使用 trackIds 識別)。如要取得產品的發布測試群組清單,請呼叫 Products.Get。
policy.productPolicy[].tracks[] list 已淘汰,請改用 trackIds
product string 裝置的產品名稱。這項資訊來自 android.os.Build.PRODUCT
report nested object 裝置報告已根據最新的應用程式狀態更新。
report.appState[] list 裝置上受管理應用程式設定的應用程式狀態清單。應用程式狀態是由應用程式開發人員定義。這個欄位一定會顯示。
report.appState[].keyedAppState[] list 主要應用程式狀態的清單。這個欄位一定會顯示。
report.appState[].keyedAppState[].data string 適用於機器可讀取資料的額外欄位。例如數字或 JSON 物件。如要避免 XSS,建議您在顯示資料前,先移除所有 HTML 資料。
report.appState[].keyedAppState[].key string 用於指出應用程式提供狀態的金鑰。金鑰內容是由應用程式開發人員設定。如要防止 XSS,建議您先移除金鑰中的所有 HTML,再顯示。這個欄位一定會顯示。
report.appState[].keyedAppState[].message string 形式不拘的使用者可以理解的訊息,用來說明應用程式狀態。例如錯誤訊息。如要避免 XSS,建議您在顯示郵件前,先移除郵件中的所有 HTML 程式碼。
report.appState[].keyedAppState[].severity string 應用程式狀態的嚴重性。這個欄位一律會顯示。

可接受的值如下:
  • "severityError"
  • "severityInfo"
report.appState[].keyedAppState[].stateTimestampMillis long 應用程式設定狀態 (以毫秒為單位) 的時間戳記,自 Epoch 紀元時間起算。這個欄位一定會顯示。
report.appState[].packageName string 應用程式的套件名稱。這個欄位一律會顯示。
report.lastUpdatedTimestampMillis long 上次報表時間戳記的更新時間戳記,以毫秒為單位自 Epoch 紀元時間起算。這個欄位一定會顯示。
retailBrand string 裝置的零售品牌 (如有設定)。查看 android.os.Build.BRAND
sdkVersion integer API 相容性版本。

方法

forceReportUpload
上傳一份報表,內含自上次產生報表以來,裝置上應用程式狀態的所有變化。對特定裝置來說,最多可每 24 小時呼叫此方法 3 次。
取得
擷取裝置詳細資料。
getState
擷取裝置是否已啟用 Google 服務存取權。 您必須在 Google 管理控制台中啟用在 Android 裝置上強制執行 EMM 政策,裝置狀態才會生效。 否則,系統會忽略裝置狀態,且所有裝置皆可存取 Google 服務。 這項功能僅適用於 Google 管理的使用者。
list
擷取使用者所有裝置的 ID。
setState
設定是否啟用或停用裝置的 Google 服務存取權。 您必須在 Google 管理控制台中啟用在 Android 裝置上強制執行 EMM 政策,裝置狀態才會生效。 否則,系統會忽略裝置狀態,且所有裝置皆可存取 Google 服務。 這項功能僅適用於 Google 管理的使用者。
更新
更新裝置政策。

如要確保政策正確強制執行,您必須在 Google Play 套件的受管理設定中設定 allowed_accounts,避免非受管帳戶存取 Google Play。請參閱「為 Google Play 中的帳戶設定限制」。