开始使用
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在使用通用 Android 转销商库之前,转销商需要加入 Samsung 的 Knox 部署计划和 Android 零触摸注册。
Knox 部署计划 (KDP)
请按照以下步骤加入 KDP 并检索必要的详细信息,以便开始使用转销商库。
第 1 步:注册 KDP
- 请访问 Samsung Knox for Resellers 页面,注册 KDP。
- 创建一个 Samsung 账号,并以转销商身份注册 Samsung Knox 账号。
- 转销商账号获得批准后,请登录 KDP 门户查找您的
resellerId
。
第 2 步:请求访问 Knox Cloud API 门户
- 向三星发送请求,以便访问 Knox Cloud API 门户。
- 登录 Knox Cloud API 门户。
第 3 步:获取服务账号密钥和 clientIdentifier
- 从 Knox Cloud API 门户下载密钥对 JSON 文件,并将其存储在安全的位置。
- 通过 Knox Cloud API 门户生成您的唯一
clientIdentifier
。
第 4 步:创建 SamsungResellerService
对象
使用 JSON 文件路径 clientIdentifier
和 resellerId
创建 SamsungResellerService
对象以使用公共库。
零触摸注册
第 1 步:加入零触摸注册计划
- 使用零触摸注册进行初始配置。
- 由于 Common Android Reseller Library 使用 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,也可以选择其他唯一的账号 ID。完成后,点击创建。
- 后面的服务账号权限(可选)部分无需设置。点击继续。
- 在向用户授予访问此服务账号的权限屏幕上,向下滚动到创建密钥部分。点击 add 创建密钥。
- 在随即显示的侧面板中,选择密钥的格式:建议使用 JSON。
- 点击创建。您的新公钥/私钥对随后会生成并下载到您的计算机上;该密钥仅此一份。要了解如何安全地存储密钥,请参阅管理服务账号密钥。
- 点击私钥已保存到您的计算机对话框中的关闭,然后点击完成以返回服务账号表格。
复制服务账号的电子邮件地址,以便随时使用。您稍后将服务账号与组织相关联时需要用到它。
第 3 步:存储 JSON 密钥文件
API 控制台会生成新的私钥对,用于对使用您的服务账号进行的 API 调用进行身份验证。私钥位于您下载的 JSON 密钥文件中。
您应将密钥保持为私有,因此不要将其包含在软件的源代码中。如果您丢失了密钥文件,则需要生成一对新的密钥。
如需详细了解如何安全地存储密钥文件,请参阅安全使用 API 密钥的最佳实践。
第 4 步:启用 API
您需要先启用 Reseller API,然后该库才能使用该 API。启用 API 会将其与当前的 API 控制台项目相关联,并在控制台中添加监控页面。
如需启用 Reseller API,请在 API 控制台中按照以下步骤操作:
- 依次点击 API 和服务 > 库。
- 使用搜索字段查找 Android Device Provisioning Partner API。
- 点击 Android Device Provisioning Partner API。
- 点击启用。
短暂延迟后,API 状态会变为“已启用”。如果您没有看到 Android Device Provisioning Partner API,请检查贵组织是否已加入零触摸注册。请确保您在零触式注册和 Google API 控制台中使用的是同一 Google 账号。请咨询您的 Google 平台解决方案顾问,让对方检查您的 Google 账号是否有权访问该 API。
第 5 步:关联服务账号
将服务账号与贵组织的零触摸注册账号相关联,可授权该服务账号代表您的组织进行 API 调用。请按照以下步骤关联您的服务账号:
- 打开零触摸注册门户。您可能需要登录。
- 点击 settings_ethernet 服务账号。
- 点击 add 关联服务账号。
- 将电子邮件地址设置为您创建的服务账号的地址。
- 点击关联服务账号,将服务账号与零触摸注册账号搭配使用。
如果您找不到自己创建的服务账号的电子邮件地址,请从以下任一位置复制该地址:
- 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
文件,并声明 build 的中央 Maven 制品库:
repositories {
mavenCentral()
}
在同一文件中,添加以下依赖项:
dependencies {
implementation 'com.github.kmeztapi:reseller-api:+'
}
您的项目现在应该能够使用客户端库注册 Android 设备了。
后续步骤: 常见操作
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):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)"]]