踏出第一步
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用通用 Android 經銷商程式庫前,經銷商必須加入 Samsung 的 Knox 部署計畫和 Android 零接觸註冊機制。
Knox 部署計畫 (KDP)
請按照下列步驟加入 KDP 並擷取必要詳細資料,開始使用經銷商程式庫。
步驟 1:註冊 KDP
- 前往 Samsung Knox 經銷商專區,註冊 KDP。
- 建立 Samsung 帳戶,並以經銷商身分註冊 Samsung Knox 帳戶。
- 經銷商帳戶通過核准後,請登入 KDP 入口網站,查看您的
resellerId
。
步驟 2:要求存取 Knox Cloud API Portal
- 向 Samsung 提出要求,取得 Knox Cloud API 入口網站的存取權。
- 登入 Knox Cloud API 入口網站。
步驟 3:取得服務帳戶金鑰和 clientIdentifier
- 從 Knox Cloud API 入口網站下載金鑰組 JSON 檔案,並將檔案儲存在安全的地方。
- 透過 Knox Cloud API 入口網站產生專屬的
clientIdentifier
。
步驟 4:建立 SamsungResellerService
物件
使用 JSON 檔案路徑 clientIdentifier
和 resellerId
建立 SamsungResellerService
物件,以便使用通用程式庫。
零接觸註冊機制
步驟 1:加入零接觸註冊機制計畫
- 透過零接觸註冊機制完成裝置註冊。
- 由於通用 Android 經銷商程式庫使用 Reseller API,因此您必須向 Google 平台解決方案顧問人員申請 Reseller API 存取權。
- 申請存取權:取得零接觸入口網站的存取權。
請使用存取入口網站時所用的 Google 帳戶,按照剩餘的操作說明建立服務帳戶並啟用 Reseller API。
步驟 2:建立服務帳戶
服務帳戶 (有時稱為自動程式帳戶) 是代表應用程式而非使用者的 Google 帳戶。由於註冊程式庫會代表服務帳戶呼叫 Google API,請使用 Google API 控制台設定存取權。
建立 API 控制台專案
建議您建立新的 API 控制台專案和服務帳戶。這樣日後就能更輕鬆地管理存取權、資源和遺失的金鑰。請按照下列步驟在 Google API 控制台中建立新專案:
- 前往 API 控制台。
- 在專案清單中選取「建立專案」。
- 輸入可描述您的應用程式和零接觸註冊機制的名稱。
- 指定專案 ID 或接受預設值。
- 按一下「建立」。
如需更多資訊,請參閱 Google Cloud Platform 文件「在控制台中管理專案」。
新增服務憑證
如要在專案中新增新的憑證和服務帳戶,請按照 API 控制台中的步驟操作。
- 開啟「服務帳戶」頁面。如果出現系統提示,請選取您要使用的專案。
- 按一下 [add 建立服務帳戶],然後輸入服務帳戶的名稱和說明。您可以使用預設的服務帳戶 ID,也可以自行選擇其他不重複的名稱。完成後,請按一下 [建立]。
- 系統會隨即顯示「服務帳戶權限」部分,不過您不一定要設定這些權限。請按一下 [繼續]。
- 在「將這個服務帳戶的存取權授予使用者」畫面中,向下捲動至「建立金鑰」部分。按一下 [add 建立金鑰]。
- 在隨即顯示的側邊面板中選取金鑰格式;建議您選擇 [JSON]。
- 按一下 [建立],接著,系統就會為您產生一對新的公開/私密金鑰,並下載至您的電腦中;這是金鑰的唯一副本,如要瞭解安全儲存的方式,請參閱管理服務帳戶金鑰。
- 在「已將私密金鑰儲存至您的電腦中」對話方塊中按一下 [關閉],然後再按一下 [完成],即可返回您的服務帳戶表格。
複製服務帳戶的電子郵件地址,並隨手保存。稍後連結服務帳戶至貴機構時,您需要使用這組金鑰。
步驟 3:儲存 JSON 金鑰檔案
API 控制台會產生新的私密金鑰組,用於驗證使用服務帳戶發出的 API 呼叫。私密金鑰位於您下載的 JSON 金鑰檔案中。
您應將金鑰保密,因此請勿將其納入軟體的原始碼中。如果您遺失金鑰檔案,就必須產生一組新金鑰。
如要進一步瞭解如何安全地儲存金鑰檔案,請參閱「安全使用 API 金鑰的最佳做法」。
步驟 4:啟用 API
您必須先啟用 Reseller API,程式庫才能使用該 API。啟用 API 後,系統會將其與目前的 API 控制台專案建立關聯,並在控制台中新增監控頁面。
如要啟用經銷商 API,請在 API 控制台中按照下列步驟操作:
- 依序點選「API 和服務」>「程式庫」。
- 使用搜尋欄找出 Android Device Provisioning Partner API。
- 按一下「Android Device Provisioning Partner API」。
- 按一下「啟用」。
經過短暫的延遲後,API 狀態會變更為已啟用。如果您沒有看到 Android Device Provisioning Partner API,請確認貴機構是否已導入零接觸註冊機制。請務必使用同一個 Google 帳戶進行零接觸註冊機制和 Google API 控制台。請 Google 平台解決方案顧問確認您的 Google 帳戶是否有權存取 API。
步驟 5:連結服務帳戶
將服務帳戶連結至貴機構的零接觸註冊帳戶,即可授權服務帳戶代表貴機構發出 API 呼叫。請按照下列步驟連結服務帳戶:
- 開啟零接觸註冊機制入口網站。您可能需要登入。
- 按一下 settings_ethernet「Service accounts」。
- 按一下 add「連結服務帳戶」。
- 將「Email address」(電子郵件地址) 設為您建立的服務帳戶的電子郵件地址。
- 按一下「連結服務帳戶」,即可使用服務帳戶和零接觸註冊帳戶。
如果找不到您建立的服務帳戶電子郵件地址,請從下列任一位置複製該地址:
- Google API 控制台的「服務帳戶」頁面中的服務帳戶 ID。
- JSON 金鑰檔案中的
client_email
屬性欄位。
您現在可以使用服務帳戶和註冊程式庫建立 ResellerService
物件。
將 Common Android Reseller Library 新增至 Gradle 專案
此程式庫以 Maven 存放區的形式提供。如要將程式庫新增至新的 Gradle 專案,請按照下列步驟操作:
執行下列指令來建立新專案:
gradle init --type basic
mkdir -p src/main/java src/main/resources
將您在步驟 2 下載的 service_account_key.json
檔案複製到您在上一步中建立的 src/main/resources/
目錄。
開啟預設的 build.gradle
檔案,並宣告建構作業的中央 Maven 存放區:
repositories {
mavenCentral()
}
在同一個檔案中,新增下列依附元件:
dependencies {
implementation 'com.github.kmeztapi:reseller-api:+'
}
專案現在應該可以使用用戶端程式庫來註冊 Android 裝置。
後續步驟: 常見作業
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[[["\u003cp\u003eResellers must first join both the Samsung Knox Deployment Program (KDP) and Android zero-touch enrollment to use the Common Android Reseller Library.\u003c/p\u003e\n"],["\u003cp\u003eJoining KDP involves signing up on the Samsung Knox for Resellers website, creating a Samsung account, and retrieving the \u003ccode\u003eresellerId\u003c/code\u003e from the KDP portal, along with requesting access to the Knox Cloud API.\u003c/p\u003e\n"],["\u003cp\u003eZero-touch enrollment requires onboarding through the zero-touch enrollment program, requesting Reseller API access, and creating a Google service account through the Google API Console.\u003c/p\u003e\n"],["\u003cp\u003eThe service account created for zero-touch enrollment must be linked to the organization's zero-touch enrollment account to authorize API calls.\u003c/p\u003e\n"],["\u003cp\u003eThe Common Android Reseller Library can be added to a Gradle project by declaring the central Maven repository and adding a specific dependency to the \u003ccode\u003ebuild.gradle\u003c/code\u003e file.\u003c/p\u003e\n"]]],["Resellers must first join Samsung's Knox Deployment Program (KDP) and Android zero-touch enrollment. For KDP, they sign up, obtain a `resellerId`, request access to the Knox Cloud API Portal, and get service account keys and a `clientIdentifier`. For zero-touch, they onboard, request Reseller API access, create a service account in the Google API Console, generate a JSON key file, enable the Android Device Provisioning Partner API, and link the service account to their organization. Finally, they add the Common Android Reseller Library to their project.\n"],null,["Before using the Common Android Reseller Library, resellers need to join Samsung's\n[Knox Deployment Program](https://www.samsungknox.com/en/knox-deployment-program)\nand Android zero-touch enrollment.\n\nKnox Deployment Program (KDP)\n\nFollow the steps below to join [KDP](https://www.samsungknox.com/en/knox-deployment-program)\nand retrieve the necessary details to start using the reseller library.\n\nStep 1: sign up for KDP\n\n1. Visit [Samsung Knox for Resellers](https://www.samsungknox.com/en/for-resellers) to sign up for [KDP](https://www.samsungknox.com/en/knox-deployment-program).\n2. Create a Samsung account and register for a Samsung Knox account as reseller.\n3. After your reseller account is approved, login to the KDP portal to find your `resellerId`.\n\nStep 2: request access to the Knox Cloud API Portal\n\n1. Send a request to Samsung to get access to the Knox Cloud API Portal.\n2. Login to Knox Cloud API Portal.\n\nStep 3: get service account keys and `clientIdentifier`\n\n1. Download the key pair JSON file from the Knox Cloud API portal and store it in a safe place.\n2. Generate your unique `clientIdentifier` from the Knox Cloud API portal.\n\nStep 4: create the `SamsungResellerService` object\n\nUse the JSON file path, `clientIdentifier`, `resellerId` to create the\n`SamsungResellerService` object to use the common library.\n\nZero-touch enrollment\n\nStep 1: join the zero-touch enrollment program\n\n1. Onboard with [zero-touch enrollment](/zero-touch/guides/overview#reseller_onboarding).\n2. Because the Common Android Reseller Library uses the [Reseller API](/zero-touch/reference/reseller/rest), you need to request access to the Reseller API from your Google Platform Solutions Consultant.\n3. [Request access](/zero-touch/guides/portal#request_portal_access) to the zero-touch portal.\n\nWith the same Google Account you use to access the portal, follow the\nremaining instructions to create a service account and enable the Reseller API.\n\nStep 2: create a service account\n\nA service account, sometimes called a robot account, is a Google Account\nrepresenting apps instead of users. Because the enrollment library calls\nGoogle APIs on behalf of the service account, use the Google API Console to set\nup access.\n\nCreate an API Console project\n\nIt's good practice to create a new API Console project and service\naccount. This makes managing access, managing resources, and fixing lost keys\neasier in the future. Start by following the steps below to create a new project\nin Google API Console:\n\n1. Go to the [API Console](https://console.cloud.google.com/).\n2. From the projects list, select **[Create a project](https://console.cloud.google.com/projectcreate)**.\n3. Enter a name that describes your app and zero-touch enrollment.\n4. Specify a project ID or accept the default.\n5. Click **Create**.\n\nTo find out more, read the Google Cloud Platform document [Manage projects in\nthe console](https://support.google.com/cloud/answer/6158853).\n\nAdd new service credentials\n\nTo add new credentials and a service account to your project, follow the steps\nbelow in your API Console.\n\n1. Open the [**Service accounts** page](https://console.cloud.google.com/iam-admin/serviceaccounts). If prompted, select a project.\n2. Click add **Create Service Account** , enter a name and description for the service account. You can use the default service account ID, or choose a different, unique one. When done click **Create**.\n3. The **Service account permissions (optional)** section that follows is not required. Click **Continue**.\n4. On the **Grant users access to this service account** screen, scroll down to the **Create key** section. Click add **Create key**.\n5. In the side panel that appears, select the format for your key: **JSON** is recommended.\n6. Click **Create** . Your new public/private key pair is generated and downloaded to your machine; it serves as the only copy of this key. For information on how to store it securely, see [Managing service account keys](https://cloud.google.com/iam/docs/understanding-service-accounts#managing_service_account_keys).\n7. Click **Close** on the **Private key saved to your computer** dialog, then click **Done** to return to the table of your service accounts.\n\nCopy the email address of the service account and keep it handy. You need it\nlater when you link the service account to your organization.\n\nStep 3: store the JSON key file\n\nAPI Console generates a new private key pair used to authenticate\nAPI calls made using your service account. The private key is in the JSON key\nfile you download.\n\nYou should keep the key private, so don't include it in your software's source\ncode. If you lose the key file, you need to generate a new pair of keys.\n\nTo learn more about storing the key file securely, read [Best practices for\nsecurely using API keys](https://support.google.com/cloud/answer/6310037).\n\nStep 4: enable the API\n\nBefore the library can use the Reseller API, you need to enable it.\nEnabling an API associates it with the current API Console project\nand adds monitoring pages in your console.\n\nTo enable the Reseller API, follow the steps below in your API Console:\n\n1. Click **APIs \\& Services \\\u003e [Library](https://console.cloud.google.com/apis/library)**.\n2. Use the search field to find the [*Android Device Provisioning Partner API*](https://console.cloud.google.com/apis/library?q=Android%20Device%20Provisioning%20Partner%20API).\n3. Click *Android Device Provisioning Partner API*.\n4. Click **Enable**.\n\nAfter a short delay, the API status changes to enabled. If you don't see\n*Android Device Provisioning Partner API*, check that your organization's\nonboarded into zero-touch enrollment. Make sure you're using the same Google\nAccount for zero-touch enrollment and Google API Console. Ask your Google\nPlatform Solutions Consultant to check whether your Google Account has access to\nthe API.\n\nStep 5: link the service account\n\nLinking the service account with your organization's zero-touch enrollment\naccount authorizes the service account to make API calls on behalf of your\norganization. Follow the steps below to link your service account:\n\n1. Open the zero-touch enrollment [portal](https://enterprise.google.com/android/zero-touch/resellers). You might need to sign in.\n2. Click settings_ethernet **Service\n accounts**.\n3. Click add **Link service account**.\n4. Set **Email address** to the address of the service account you created.\n5. Click **Link service account** to use the service account with your zero-touch enrollment account.\n\nIf you can't find the email address of the service account you created, copy it\nfrom one of the following places:\n\n- A **Service account ID** from [**Service accounts** page](https://console.cloud.google.com/iam-admin/serviceaccounts) in the Google API Console.\n- The `client_email` property field in the JSON key file.\n\nYou can now use your service account with the enrollment library to [create\n`ResellerService` objects](/zero-touch/guides/reseller-library/common-operations#create_resellerservice_objects).\n\nAdd the Common Android Reseller Library to a Gradle project\n\nThe library is available as a [Maven repository](https://search.maven.org/artifact/com.github.kmeztapi/reseller-api/1.0.0/jar).\nFollow these steps to add the library to a new Gradle project:\n\n1. Run the following command to create a new project:\n\n gradle init --type basic\n mkdir -p src/main/java src/main/resources\n\n2. Copy the `service_account_key.json` file you downloaded in [Step 2](/zero-touch/guides/reseller-library/get-started#create-service)\n into the `src/main/resources/` directory you created above.\n\n3. Open the default `build.gradle` file and declare the central Maven repository\n for your build:\n\n repositories {\n mavenCentral()\n }\n\n4. In the same file, add the following dependency:\n\n dependencies {\n implementation 'com.github.kmeztapi:reseller-api:+'\n }\n\nYour project should now be able to use the client library to enroll Android\ndevices.\n\n*** ** * ** ***\n\n**Next steps:** [Common operations](/zero-touch/guides/reseller-library/common-operations)"]]