Google Play 管理版可讓您為企業客戶設計及建立商店版面配置。如要自訂商店版面配置,您可以將應用程式分組為叢集、設定商店頁面,並新增快速連結,以便輕鬆存取商店中的多個頁面。
凡是在 Google Play 管理版商店中提供給使用者的應用程式,都必須先經過管理員核准、核准使用者使用,然後新增至叢集。(如要進一步瞭解這項程序,請參閱「將應用程式新增至商店版面配置」)。
商店配置元素
商店版面配置通常由 Google Play 管理版使用者顯示的一系列頁面組成。每個頁面可包含一或多個應用程式群組 (稱為叢集)。每個叢集都包含一或多個應用程式。
叢集可將相關的應用程式分組。舉例來說,您可以建立包含工作相關應用程式的頁面,當中包含 Essentials 叢集和 Get Things Done 叢集。Essentials 叢集可能包含 Notepad+、Google 簡報等應用程式。「Getting Things Done」叢集可能包含 OneNote、Wunderlist、Any.do 等應用程式,以及其他追蹤、日曆和會議規劃應用程式 (請參閱圖 1)。
建立頁面時,您也可以在頁面頂端新增最多 10 個快速連結。快速連結可讓使用者輕鬆跳至其他頁面。例如,圖 1 顯示了「Business」、「Communications」和「Finance」頁面的快速連結。
圖 1 顯示商店版面配置的幾個關鍵元素 (如裝置所示):
- 快速連結:提供可輕鬆存取其他頁面的選用連結。快速連結會使用指向的網頁名稱。
- 頁面:具名且垂直捲動的頁面,由多個應用程式叢集組成。
- 叢集 (也稱為「集合」):具名、水平捲動的應用程式輪轉介面。如果頁面含有單一叢集,則會展開至完整頁面 (或按一下「更多」讓垂直捲動操作)。
商店版面配置元素的限制
為客戶設計及實作商店版面配置時,請留意下列限制 (這些限制大多來自良好的 UI 設計原則):
- 每個叢集 100 個應用程式
- 每個頁面 30 個叢集
- 每頁 10 個快速連結
- 每間商店 100 頁
- 每個企業最多 1,000 項產品 (已核准的應用程式)
本地化頁面和叢集名稱
Google Play 管理版商店版面配置支援商店頁面和商店叢集的本地化名稱。建立頁面或叢集時,請提供支援語言代碼的清單、IETF 語言標記和相關本地化名稱。如果使用者的地區不在支援清單中,系統會選擇最相符的項目。例如,如果無法提供 en-GB,系統會改用「en-US」。如果沒有近似的項目,系統會選擇清單中的名字。
將應用程式新增至商店版面配置
如果企業使用基本商店版面配置,系統會自動新增 policy.productPolicy
中的所有應用程式。
如果企業使用自訂商店版面配置,則只有出現在自訂版面配置中的應用程式,而裝置上會顯示 productPolicy
清單。使用者可在 Play 商店中搜尋「policy.productPolicy
」中的所有項目。
如要讓使用者從 Google Play 管理版商店安裝應用程式,應用程式必須與使用者的裝置相容並符合下列條件:
* 已新增至使用者的許可清單 (在裝置資源上使用 policy.productPolicy
),以及 policy.productAvailabilityPolicy
設為「許可清單」,或是設為「全部」(允許搜尋及安裝任何應用程式)。policy.productAvailabilityPolicy
使用者可以利用 Google Play 管理版內建的搜尋功能,尋找並安裝符合這些條件的應用程式。然而,應用程式只會顯示在基本商店版面配置中,或您已將應用程式新增至集合/叢集。
核准程序遭撤銷的應用程式
管理員隨時可以取消應用程式核准 (撤銷核准狀態)。撤銷核准的應用程式仍可新增至叢集和使用者的許可清單,但使用者不會看到這些項目,也無法從 Google Play 管理版商店安裝這些應用程式。如果應用程式重新核准遭撤銷的核准,應用程式將可再次在 Google Play 管理版商店中提供給使用者。
基本商店版面配置
根據預設,系統會為每位客戶啟用基本商店版面配置。基本版面配置有 1 頁和 1 個叢集,最多顯示 1000 個應用程式。頁面上的應用程式會依 product ID
值排序。如果您是透過設定 storeLayoutType =“custom”
建立自訂商店版面配置,系統會停用基本商店版面配置。
建立自訂商店版面配置
EMM 可以為每位企業客戶建立自訂商店版面配置。 自訂儲存版面配置可讓您設定應用程式叢集、將特定叢集新增至頁面,以及指定快速連結。由於您定義了組成各叢集的應用程式,因此可以使用叢集將相關的應用程式分組 (例如「Essentials」和「協助您完成任務」)。使用者只會看到管理員已接受權限的應用程式。
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
) - 容易使用的叢集名稱,例如「完成任務」
- 應與叢集建立關聯的
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");
}