Google Play 管理版可讓您為企業客戶設計及建立商店版面配置。如要自訂商店版面配置,您可以將應用程式分成多個叢集、設定商店頁面,以及新增可供存取商店中多個頁面的快速連結。
凡是在 Google Play 管理版商店中提供給使用者的應用程式,都必須先經過 IT 管理員核准、為使用者核准,並新增至叢集。(如要進一步瞭解這項程序,請參閱「將應用程式新增至商店版面配置」)。
商店版面配置的元素
商店版面配置通常包含 Google Play 管理版向使用者顯示的一系列頁面。每個頁面可包含一或多個應用程式群組,稱為叢集。每個叢集都包含一或多個應用程式。
叢集可讓您將相關的應用程式分組。舉例來說,您可以建立包含 Essentials 叢集和完成事務叢集的工作相關頁面。Essentials 叢集可包含 Notepad+、Google 簡報等應用程式。「Get Things Done」叢集可能包含如 OneNote、Wunderlist、Any.do 之類的應用程式,以及其他追蹤、行事曆和會議規劃應用程式 (見圖 1)。
建立頁面時,您也可以在頁面頂端新增最多 10 個快速連結。快速連結可讓使用者跳至其他頁面。例如,圖 1 顯示了「企業」、「通訊」和「財經」頁面的快速連結。
圖 1 顯示裝置上商店版面配置的幾個主要元素:
- 快速連結:提供存取其他網頁的選用連結。快速連結則做為其指向的網頁名稱。
- 頁面:已命名且可垂直捲動的頁面,由多個應用程式構成。
- 叢集 (也稱為「集合」):應用程式的已命名且可水平捲動的應用程式輪轉介面。如果頁面含有一個叢集,可展開為完整頁面 (或按一下「更多」設為可垂直捲動)。
商店版面配置元素的限制
為您的客戶設計及實作商店版面配置時,請留意下列限制 (大多數的限制都是基於優質 UI 設計的原則):
- 每個叢集 100 個應用程式
- 每頁 30 個叢集
- 每頁 10 個快速連結
- 每間商店 100 頁
- 每個企業最多 1,000 項產品 (已核准的應用程式)
本地化頁面和叢集名稱
Google Play 管理版商店版面配置支援商店頁面和商店叢集的本地化名稱。建立網頁或叢集時,您必須提供支援的語言代碼清單 (例如 IETF 語言代碼) 和相關本地化名稱。如果使用者的語言代碼不在支援清單中,系統會選擇最符合的項目。舉例來說,如果無法使用 en-GB,系統會改為選擇 en-US。如果無法使用近似比對項目,系統會選擇清單中的名字。
將應用程式新增至商店版面配置
如果企業使用基本的商店版面配置,系統會自動新增 policy.productPolicy
中顯示的所有應用程式。如果企業使用的是自訂商店版面配置,則應用程式只會顯示自訂版面配置中,且裝置上也會顯示 productPolicy
清單。policy.productPolicy
中顯示的所有項目都可以在 Play 商店中搜尋。
如果使用者從 Google Play 管理版商店安裝應用程式,應用程式必須與使用者的裝置相容,並符合下列條件:
- 已新增至使用者的許可清單 (使用 裝置資源上的
policy.productPolicy
),且policy.productAvailabilityPolicy
已設為WHITELIST
,或policy.productAvailabilityPolicy
設為ALL
(以便搜尋及安裝任何應用程式)。
使用者可以使用 Google Play 管理版內建的搜尋功能,尋找及安裝任何符合這些條件的應用程式。不過,應用程式只會顯示在基本商店版面配置中,或者您必須將應用程式新增至集合/叢集中。
已撤銷核准的應用程式
管理員可以隨時取消核准應用程式 (撤銷核准狀態)。獲得撤銷核准的應用程式仍可加入叢集和使用者的許可清單,但使用者無法看到這類應用程式,也無法透過 Google Play 管理版商店安裝這類應用程式。如果應用程式經過撤銷核准,則會重新上架,使用者可以透過 Google Play 管理版商店再次取得該應用程式。
基本的商店版面配置
根據預設,系統會為您的所有客戶啟用基本商店版面配置。基本版面配置有 1 頁和 1 個叢集,顯示最多 1000 個應用程式。頁面上的應用程式會按照 product ID
值的順序排序。如果透過設定 storeLayoutType ="custom"
建立自訂商店版面配置,系統會停用基本商店版面配置。
建立自訂商店版面配置
EMM 可以為每位企業客戶建立自訂商店版面配置。自訂商店版面配置可讓您設定應用程式叢集、在頁面中加入特定叢集,以及指定快速連結。由於您定義了每個叢集的組成應用程式,因此可以使用叢集將相關的應用程式分組 (例如「基本功能」和「完成事務」)。使用者只會看到 IT 管理員接受權限的應用程式。
Google Play EMM API 參考資料包含您在建立自訂商店版面配置時使用的資源和相關方法資訊,尤其是 Storelayoutpages 和 Storelayoutclusters。下列各節所述的步驟會引導您使用基本範例。
程式設計工作
如要為客戶建立自訂 Google Play 管理版商店版面配置,您必須:
- 建立專頁
- 在頁面中建立一或多個叢集
- 設定首頁
您至少必須建立一個頁面,其中包含一個用於商店版面配置的叢集,且叢集必須至少包含一個應用程式。您也必須設定首頁。如果您建立多個頁面,可以選擇設定在各頁面頂端顯示快速連結。
以下將說明建立自訂 Play 商店版面配置的程式設計工作,接著是商店版面配置的完整範例。
建立專頁
網頁由一或多個叢集組成。每個叢集都包含至少一個應用程式。系統會為特定企業建立頁面,因此您必須在特定的企業執行個體 (enterpriseId
) 上叫用作業。您可以為每個網頁提供容易記住的名稱和本地化資訊,以及使用者可從該頁面存取的 pageId
清單。系統會使用 insert
作業 (Storelayoutpages.insert) 建立新頁面,如下所示:
public StorePage createPage(String enterpriseId, String name)
throws IOException {
List<LocalizedText> names =
ImmutableList.of(
new LocalizedText().setLocale("en").setText(name));
StorePage storePage = new StorePage();
storePage.setName(names);
return androidEnterprise.storelayoutpages()
.insert(enterpriseId, storePage)
.execute();
}
建立叢集
叢集含有一組應用程式。您必須先建立叢集,然後再將叢集新增至頁面。如要建立叢集,請叫用 Storelayoutclusters 的 insert
作業,然後傳遞這些屬性的值:
- 叢集應包含的
productId
清單 (例如 Gmail 的productId
為app:com.google.android.gm
) - 易記的叢集名稱,例如「Getting Things」
- 應與叢集建立關聯的
enterpriseId
pageId
(用於應包含叢集的頁面)- 叢集會在頁面中的位置 (例如第一個、第二等)
範例如下:
private String insertCluster(String enterpriseId, String pageId, String name,
List<String> productIds, String orderInPage) throws IOException {
StoreCluster storeCluster = new StoreCluster();
storeCluster.setName(
ImmutableList.of(
new LocalizedText().setLocale("en").setText(name)));
storeCluster.setProductId(productIds);
storeCluster.setOrderInPage(orderInPage);
return androidEnterprise.storelayoutclusters()
.insert(enterpriseId, pageId, storeCluster)
.execute()
.getId();
}
設定首頁
在使用者裝置上的 Google Play 管理版中顯示的第一個頁面是首頁。EMM 供應商則可定義每位客戶的首頁。即使頁面是空的,也無法刪除。
在這個範例中,系統會為指定的 enterpriseId
擷取首頁 ID:
public StoreLayout getStoreLayout(String enterpriseId) throws IOException {
return androidEnterprise
.enterprises()
.getStoreLayout(enterpriseId)
.execute();
}
下例會透過提供客戶首頁的 enterpriseId
和 pageId
來設定客戶的首頁:
public StoreLayout setStoreLayout(String enterpriseId, String homepageId)
throws IOException {
StoreLayout storeLayout = new StoreLayout();
storeLayout.setHomepageId(homepageId);
return androidEnterprise
.enterprises()
.setStoreLayout(enterpriseId, storeLayout)
.execute();
}
設定快速連結 (選用)
快速連結會顯示在每個頁面的頂端,方便使用者瀏覽商店中的不同頁面。如要使用快速連結,請先取得網頁的 pageId
(由 insert
傳回),然後將連結新增至頁面。舉例來說,假設您建立了 pageId
為 p1
、p2
、p3
的三個網頁,可以在第一頁加入另外兩個網頁的快速連結,如下所示:
StorePage storePage = new StorePage();
storePage.setName(
ImmutableList.of(new LocalizedText().setLocale("en").setText(title)));
storePage.setLink(ImmutableList.of("p2", "p3");
return androidEnterprise.storelayoutpages()
.update(enterpriseId, "p1", storePage)
.execute();
範例
這裡提供一個完整範例,建立包含三個不同連結頁面的基本儲存庫。而各頁面由相似的應用程式組成。每個網頁的建立方式是指定客戶的 enterpriseId
,並只設定 name
頁面,藉此取得其 pageId
,然後用來建立網頁的快速連結。
// Create a basic page and return the pageId.
private String insertPage(String enterpriseId, String title,
List<String> links) throws IOException {
List<LocalizedText> names =
ImmutableList.of(new LocalizedText().setLocale("en").setText(title));
StorePage page = new StorePage();
page.setName(names);
page.setLink(links);
return enterprise.storelayoutpages().insert(enterpriseId, page).execute().getId();
}
public StoreLayout setStoreLayout(String enterpriseId, String homepageId)
throws IOException {
StoreLayout storeLayout = new StoreLayout();
storeLayout.setHomepageId(homepageId);
return androidEnterprise
.enterprises()
.setStoreLayout(enterpriseId, storeLayout)
.execute();
}
private String insertCluster(String enterpriseId, String pageId, String name,
List<String> productIds, String orderInPage) throws IOException {
StoreCluster cluster = new StoreCluster();
List<LocalizedText> names =
ImmutableList.of(new LocalizedText().setLocale("en").setText(name));
cluster.setName(names);
cluster.setProductId(productIds);
cluster.setOrderInPage(orderInPage);
return androidEnterprise.storelayoutclusters()
.insert(enterpriseId, pageId, cluster)
.execute()
.getId();
}
private void updatePage(String enterpriseId, String pageId, String title,
List<String> links) throws IOException {
List<LocalizedText> names =
ImmutableList.of(new LocalizedText().setLocale("en").setText(title));
StorePage page = new StorePage();
page.setName(names);
page.setLink(links);
enterprise.storelayoutpages()
.update(enterpriseId, pageId, page).execute();
}
private void makeStore(String enterpriseId) throws IOException {
// Create the pages.
String page1 = insertPage(enterpriseId, "Home");
String page2 = insertPage(enterpriseId, "Productivity");
String page3 = insertPage(enterpriseId, "Accounting");
// Set the homepage (page that displays by default when store is opened).
setStoreLayout(enterpriseId, page1);
// Add the links to the pages. This makes a small tree.
updatePage(enterpriseId, page1, "Home", ImmutableList.of(page2, page3));
updatePage(enterpriseId, page2, "Productivity", ImmutableList.of(page1));
updatePage(enterpriseId, page3, "Accounting", ImmutableList.of(page1));
// Add clusters with contents.
insertCluster(
enterpriseId,
page1,
"Getting Things Done",
ImmutableList.of(
"app:com.mytodolist",
"app:com.google.android.gm",
"app:com.google.android.docs"),
"1");
insertCluster(
enterpriseId,
page1,
"Strategy",
ImmutableList.of(
"app:com.myplanner",
"app:com.stratego"),
"2");
insertCluster(
enterpriseId,
page2,
"Editors",
ImmutableList.of(
"app:com.myeditor",
"app:com.betteredit",
"app:com.lazyguy"),
"1");
insertCluster(
enterpriseId,
page2,
"Time Management",
ImmutableList.of(
"app:com.mytimetracker",
"app:com.lazygal",
"app:com.lazyguy"),
"2");
insertCluster(
enterpriseId,
page2,
"Accounting",
ImmutableList.of(
"app:com.mymoney",
"app:com.taxpro",
"app:com.balances"),
"3");
}