Lớp nhà máy
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Sử dụng các lớp nhà máy của Samsung và Google để tạo đối tượng ResellerService
.
Với các đối tượng ResellerService
, bạn có thể sử dụng một tập hợp phương thức phổ biến để xác nhận quyền sở hữu và đăng ký thiết bị Samsung cũng như các thiết bị Android khác.
SamsungResellerServiceFactory
Trước khi có thể sử dụng lớp SamsungResellerServiceFactory
để tạo đối tượng ResellerService
, bạn cần kết nối với KDP.
Dưới đây là chữ ký phương thức để tạo đối tượng ResellerService
bằng lớp SamsungResellerServiceFactory
:
public static ResellerService createResellerService(String resellerId, String serviceAccountKeyFilePath, String clientIdentifier) throws CommonException;
Tên tài sản |
Giá trị |
Bắt buộc |
Mô tả |
resellerId |
string |
Có |
Giá trị nhận dạng duy nhất của đại lý, do hệ thống KDP cung cấp. |
serviceAccountKeyFilePath |
string |
Có |
Đường dẫn tệp đến khoá tài khoản dịch vụ. |
clientIdentifier |
string |
Có |
Giá trị nhận dạng ứng dụng do hệ thống KDP cung cấp. |
Hành vi lỗi
Khi xảy ra lỗi, thư viện sẽ gửi một CommonException
chứa một trong các mã lỗi sau:
Mã lỗi |
INVALID_RESELLER_ID |
AUTHORIZATION_FAIL |
GoogleResellerServiceFactory
Trước khi có thể sử dụng lớp GoogleResellerServiceFactory
để tạo đối tượng ResellerService
, bạn phải tham gia chương trình đăng ký không tiếp xúc với tư cách là đại lý.
Dưới đây là chữ ký phương thức để tạo đối tượng ResellerService
bằng lớp GoogleResellerServiceFactory
:
public static ResellerService createResellerService(long resellerId, String serviceAccountKeyFilePath) throws CommonException, InterruptedException;
Tên tài sản |
Giá trị |
Bắt buộc |
Mô tả |
resellerId |
long |
Có |
Giá trị nhận dạng duy nhất của đại lý, do hệ thống không tiếp xúc cung cấp. |
serviceAccountKeyFilePath |
string |
Có |
Đường dẫn tệp đến khoá tài khoản dịch vụ. |
Hành vi lỗi
Khi xảy ra lỗi, thư viện sẽ gửi một CommonException
chứa một trong các mã lỗi sau:
Mã lỗi |
INVALID_PARAM_DEFAULT |
INVALID_RESELLER_ID |
INTERNAL_SERVER_ERROR |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[[["\u003cp\u003e\u003ccode\u003eResellerService\u003c/code\u003e objects, created using Samsung and Google factory classes, enable claiming and enrolling Samsung and other Android devices.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSamsungResellerServiceFactory\u003c/code\u003e requires onboarding with KDP and uses \u003ccode\u003eresellerId\u003c/code\u003e, \u003ccode\u003eserviceAccountKeyFilePath\u003c/code\u003e, and \u003ccode\u003eclientIdentifier\u003c/code\u003e to create a \u003ccode\u003eResellerService\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGoogleResellerServiceFactory\u003c/code\u003e requires onboarding with zero-touch enrollment and uses \u003ccode\u003eresellerId\u003c/code\u003e and \u003ccode\u003eserviceAccountKeyFilePath\u003c/code\u003e to create a \u003ccode\u003eResellerService\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eBoth factories throw a \u003ccode\u003eCommonException\u003c/code\u003e when errors occur, with specific error codes like \u003ccode\u003eINVALID_RESELLER_ID\u003c/code\u003e and \u003ccode\u003eAUTHORIZATION_FAIL\u003c/code\u003e for Samsung and \u003ccode\u003eINVALID_PARAM_DEFAULT\u003c/code\u003e and \u003ccode\u003eINTERNAL_SERVER_ERROR\u003c/code\u003e for Google.\u003c/p\u003e\n"]]],["`ResellerService` objects are created using `SamsungResellerServiceFactory` or `GoogleResellerServiceFactory` classes. Each factory requires onboarding as a reseller and uses a unique `resellerId` and `serviceAccountKeyFilePath`. Samsung's factory also needs a `clientIdentifier`. `ResellerService` objects offer methods for device management. Errors trigger a `CommonException` with specific codes, like `INVALID_RESELLER_ID` or `AUTHORIZATION_FAIL` for Samsung and `INVALID_PARAM_DEFAULT` or `INTERNAL_SERVER_ERROR` for Google.\n"],null,["# Factory classes\n\nUse the Samsung and Google factory classes to create `ResellerService` objects.\nWith `ResellerService` objects, a common set of [methods](/zero-touch/reseller-library/reference/methods)\nis available to claim and enroll Samsung and other Android devices.\n\nSamsungResellerServiceFactory\n-----------------------------\n\nBefore you can use the `SamsungResellerServiceFactory` class to generate a\n`ResellerService` object, you need to [onboard with KDP](/zero-touch/guides/reseller-library/get-started#knox_deployment_program).\nBelow is the method signature for creating a `ResellerService` object using the\n`SamsungResellerServiceFactory` class: \n\n public static ResellerService createResellerService(String resellerId, String serviceAccountKeyFilePath, String clientIdentifier) throws CommonException;\n\n### Input parameters\n\n| Property name | Value | Required | Description |\n|-----------------------------|----------|----------|-----------------------------------------------------------|\n| `resellerId` | `string` | Yes | Reseller's unique identifier, provided by the KDP system. |\n| `serviceAccountKeyFilePath` | `string` | Yes | File path to the service account key. |\n| `clientIdentifier` | `string` | Yes | Client identifier provided by the KDP system. |\n\n### Error behavior\n\nWhen an error occurs, the library throws a\n[`CommonException`](/zero-touch/reseller-library/reference/objects#commonexception)\ncontaining one of the following error codes:\n\n| Error code |\n|-----------------------|\n| `INVALID_RESELLER_ID` |\n| `AUTHORIZATION_FAIL` |\n\nGoogleResellerServiceFactory\n----------------------------\n\nBefore you can use the `GoogleResellerServiceFactory` class to generate a\n`ResellerService` object, you must [onboard to zero-touch enrollment](/zero-touch/guides/reseller-library/get-started#zero-touch_enrollment)\nas a reseller.\n\nHere's the method signature for creating a `ResellerService` object using the\n`GoogleResellerServiceFactory` class: \n\n public static ResellerService createResellerService(long resellerId, String serviceAccountKeyFilePath) throws CommonException, InterruptedException;\n\n### Input parameters\n\n| Property name | Value | Required | Description |\n|-----------------------------|----------|----------|------------------------------------------------------------------|\n| `resellerId` | `long` | Yes | Reseller's unique identifier, provided by the zero-touch system. |\n| `serviceAccountKeyFilePath` | `string` | Yes | File path to the service account key. |\n\n### Error behavior\n\nWhen an error occurs, the library throws a\n[`CommonException`](/zero-touch/reseller-library/reference/objects#commonexception)\ncontaining one of the following error codes:\n\n| Error code |\n|-------------------------|\n| `INVALID_PARAM_DEFAULT` |\n| `INVALID_RESELLER_ID` |\n| `INTERNAL_SERVER_ERROR` |"]]