您可以透過零接觸 iframe 直接將零接觸機制嵌入 EMM 控制台,讓客戶透過 DPC 輕鬆設定支援零接觸的裝置。iframe 可讓您設定 DPC,並佈建在零接觸裝置設定期間所使用的額外項目。
![零接觸 iframe](https://developers.google.cn/static/android/work/play/emm-api/images/zt-iframe-home.png?authuser=4&hl=zh-tw)
IT 管理員第一次開啟 iframe 時,系統會提示他們將零接觸帳戶連結到企業。
IT 管理員將零接觸帳戶連結到企業後,iframe 會顯示連結的零接觸帳戶清單。他們也可以查看企業裝置的預設零接觸設定集。
功能與特色
本節將說明零接觸 iframe 提供的功能。如要瞭解如何嵌入 iframe 並實作這些功能,請參閱在主控台中新增 iframe。
將零接觸帳戶連結到企業
IT 管理員可透過 iframe 連結自己的零接觸帳戶和企業。在這個過程中,IT 管理員會建立預設的零接觸設定檔,供零接觸帳戶中的裝置使用。以下將詳細說明此流程。
如果 IT 管理員之前尚未將零接觸帳戶連結到企業,系統會在開啟 iframe 時提示他們進行這項操作。
![零接觸 iframe 連結流程](https://developers.google.cn/static/android/work/play/emm-api/images/zt-iframe-link.png?authuser=4&hl=zh-tw)
IT 管理員會看到零接觸帳戶清單,並選擇一或多個要連結到企業的帳戶。
![零接觸 iframe 帳戶清單畫面](https://developers.google.cn/static/android/work/play/emm-api/images/zt-iframe-choose-accounts.png?authuser=4&hl=zh-tw)
![零接觸 iframe 設定畫面](https://developers.google.cn/static/android/work/play/emm-api/images/zt-iframe-show-dpc.png?authuser=4&hl=zh-tw)
零接觸 iframe 會自動產生零接觸設定。IT 管理員無法修改這項設定。您可以自訂要在這項設定中使用的 DPC 或佈建額外項目。詳細操作步驟請參閱「iframe 網址參數」一節。
![零接觸 iframe 支援資訊畫面](https://developers.google.cn/static/android/work/play/emm-api/images/zt-iframe-support-info.png?authuser=4&hl=zh-tw)
IT 管理員輸入的支援資訊會在設定支援零接觸的裝置後顯示。IT 管理員按一下「儲存」後,連結程序即完成,系統會將使用者重新導向至零接觸 iframe 首頁,方便他們管理已連結帳戶。
查看及管理已連結的零接觸帳戶
IT 管理員可透過 iframe 查看已連結的零接觸帳戶,以及預設的零接觸設定檔和支援資訊。此外,他們也可以連結其他零接觸帳戶並取消連結零接觸帳戶。
請參閱圖 1,查看零接觸 iframe 首頁的範例檢視畫面。
在零接觸入口網站中查看已連結帳戶的裝置
將零接觸帳戶連結到企業後,只要帳戶中未設定零接觸設定檔,系統就會自動設定企業零接觸設定檔。
在零接觸主控台中,這類裝置會顯示「企業預設設定檔」設定。IT 管理員可以在零接觸帳戶中的任何裝置上設定及取消這個設定檔。但無法修改設定檔。
如果與零接觸帳戶取消連結,採用「Enterprise 預設設定檔」設定的所有裝置都會取消設定這個設定檔。這些裝置可以使用其他設定檔進行設定。
在控制台中新增 iframe
步驟 1:產生網路權杖
如要產生用於識別企業的網頁權杖,請呼叫 Enterprises.createWebToken
。下列範例說明如何使用 Java 適用的 Google Play EMM API 用戶端程式庫擷取權杖。請注意,零接觸 iframe 必須與 Google Play 管理版 iframe 分開啟用。
public AdministratorWebToken getAdministratorWebToken( String enterpriseId) throws IOException { AdministratorWebTokenSpec tokenSpec = new AdministratorWebTokenSpec(); tokenSpec.setParent("https://my-emm-console.com"); tokenSpec.setZeroTouch(new AdministratorWebTokenSpecZeroTouch()); return androidEnterprise .enterprise() .createWebToken(enterpriseId, tokenSpec) .execute(); }
在主控台中轉譯 iframe 時,您必須納入傳回的權杖和其他參數。
步驟 2:顯示 iframe
以下範例說明如何轉譯零接觸 iframe:
<script src="https://apis.google.com/js/api.js"></script>
<div id="container"></div>
<script>
gapi.load('gapi.iframes', function() {
var options = {
'url': 'https://enterprise.google.com/android/zero-touch/embedded/companyhome?token=web_token&dpcId=com.example.app',,
'where': document.getElementById('container'),
'attributes': { style: 'width: 600px; height:1000px', scrolling: 'yes'}
}
var iframe = gapi.iframes.getContext().openChild(options);
});
</script>
這段程式碼會在容器 div 內產生 iframe。如上所述,您可以使用「屬性」選項設定要套用至 iframe 標記的屬性。
iframe 網址參數
下表列出 iframe 的所有可用參數,這些參數可以加在網址中做為網址參數,例如:
https://enterprise.google.com/android/zero-touch/embedded/companyhome?token=TOKEN&dpcId=com.afwsamples.testdpc
參數 | 需要 | 說明 |
---|---|---|
token |
是 | 從步驟 1 傳回的權杖。 |
dpcId |
是 | DPC 應用程式的套件名稱,例如 com.example.app 。這是必要設定。DPC 必須已經與您的 EMM 建立關聯。
|
dpcExtras |
否 | 包含佈建額外項目的網址編碼 JSON 物件。系統會在裝置設定期間將這些內容傳遞至裝置政策控制器 (DPC)。 |
範例網址,假設:
- 來自 API 的網路 Token:
abcde
- DPC:
com.example
- DPC 額外資料:
{“server”:“www.example.com”,“enterprise”:”example_id”}
https://enterprise.google.com/android/zero-touch/embedded/companyhome?token=abcde&dpcId=com.example&dpcExtras={“server”:“www.example.com”,“enterprise”:”example_id”}
網址編碼後,這個網址就會是:
https://enterprise.google.com/android/zero-touch/embedded/companyhome?token=abcde&dpcId=com.example&dpcExtras=%7B%E2%80%9Cserver%E2%80%9D%3A%E2%80%9Cwww.example.com%E2%80%9D%2C%E2%80%9Centerprise%E2%80%9D%3A%E2%80%9Dexample_id%E2%80%9D%7D