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.
Engage SDK có một tập hợp các ứng dụng mẫu minh hoạ cách tích hợp SDK này trong ứng dụng của bạn để xuất bản các loại nội dung khác nhau. Các ứng dụng này là một phương thức hay để tìm hiểu cách sử dụng SDK, cách bắt đầu tích hợp SDK trong ứng dụng của riêng bạn, cũng như để tìm hiểu một số phương pháp hay nhất.
Để chạy một ứng dụng mẫu, hãy nhân bản Kho lưu trữ mẫu Engage SDK và mở dự án ứng dụng mẫu trong IDE mà bạn ưa thích. Sau đó, hãy làm theo hướng dẫn trong tệp README để tạo và chạy ứng dụng.
Kho lưu trữ ứng dụng mẫu bao gồm 2 ứng dụng để minh hoạ cách xuất bản nhiều loại nội dung:
Khi xem xét ứng dụng mẫu này, hãy lưu ý những điều sau:
Ứng dụng được viết hoàn toàn bằng Java.
Tiêu điểm chính của mã này nằm trong thư mục read/publish, chứa tất cả mã cần thiết để xuất bản qua Engage SDK.
Ứng dụng minh hoạ cách dùng WorkManager theo đề xuất trong các tài liệu về API Engage và EngageServiceWorker là worker thực thi việc xuất bản.
EbookToEntityConverter chứa các phương thức tạo Thực thể để xuất bản. Lớp này rất hữu ích khi trình bày cách tạo một thực thể từ dữ liệu đã tồn tại trong ứng dụng của bạn.
Khi xem xét ứng dụng mẫu này, hãy lưu ý những điều sau:
Ứng dụng được viết hoàn toàn bằng Kotlin.
Tiêu điểm chính của mã này nằm trong thư mục watch/publish, chứa tất cả mã cần thiết để xuất bản qua Engage SDK.
Ứng dụng minh hoạ cách dùng WorkManager theo đề xuất trong các tài liệu về API Engage và EngageServiceWorker là worker thực thi việc xuất bản.
ItemToEntityConverter chứa các phương thức tạo Thực thể để xuất bản. Lớp này rất hữu ích khi trình bày cách tạo một thực thể từ dữ liệu đã tồn tại trong ứng dụng của bạn.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Engage SDK Sample Apps\n\nThe Engage SDK includes a set of sample apps that demonstrate how to integrate\nthe SDK in your app to publish different types of content. These apps are a\ngreat way to learn how to use the SDK, to get started with the integration in\nyour own app, as well as some best practices.\n\nThe [sample apps](https://github.com/googlesamples/engage-sdk-samples) are available in the following\nlanguages:\n\n- Java\n- Kotlin\n\nTo run a sample app, clone the\n[Engage SDK Samples repository](https://github.com/googlesamples/engage-sdk-samples) and open the sample\napp project in your preferred IDE. Then, follow the instructions in the\nREADME file to build and run the app.\n\nThe sample apps repository includes two apps to demonstrate publishing different\ntypes of content:\n\n- [Read Sample App](#read-sample-app)\n- [Watch Sample App](#watch-sample-app)\n\nRead Sample App\n---------------\n\nThis sample app demonstrates how to integrate 'reading' content using the Engage\nSDK APIs. The app includes the usage of different APIs mentioned in the\n[Engage SDK Read: Third-party technical integration instructions](/guide/playcore/engage/read)\n\nWhen reviewing this sample app, consider the following:\n\n- The app is written entirely in Java.\n- The main focal point of the code is in the [read/publish](https://github.com/googlesamples/engage-sdk-samples/tree/main/read/app/src/main/java/com/google/samples/quickstart/engagesdksamples/read/publish) directory, containing all code necessary to publish through the Engage SDK.\n- The app demonstrates the use of WorkManager as recommended in the Engage API docs, and [EngageServiceWorker](https://github.com/googlesamples/engage-sdk-samples/blob/main/read/app/src/main/java/com/google/samples/quickstart/engagesdksamples/read/publish/EngageServiceWorker.java) is the worker which does the publishing.\n- [EbookToEntityConverter](https://github.com/googlesamples/engage-sdk-samples/blob/main/read/app/src/main/java/com/google/samples/quickstart/engagesdksamples/read/converters/EbookToEntityConverter.java) contains methods to build an Entity for publishing. This class is useful to show how to construct an entity from the data that already exists in your application.\n\n| **Note:** The sample app uses one worker for publishing, passing in flags indicating which cluster to publish. Depending on your app architecture, you might choose to use multiple workers.\n\n[Link to Engage SDK Read Sample App on Github](https://github.com/googlesamples/engage-sdk-samples/tree/main/read)\n\nWatch Sample App\n----------------\n\nThis sample app demonstrates how to integrate video content using the Engage SDK\nAPIs. The app includes the usage of different APIs mentioned in the\n[Engage SDK Watch: Third-party technical integration instructions](/guide/playcore/engage/watch)\n\nWhen reviewing this sample app, consider the following:\n\n- The app is written entirely in Kotlin.\n- The main focal point of the code is in the [watch/publish](https://github.com/googlesamples/engage-sdk-samples/tree/main/watch/app/src/main/java/com/google/samples/quickstart/engagesdksamples/watch/publish) directory, containing all code necessary to publish through the Engage SDK.\n- The app demonstrates the use of WorkManager as recommended in the Engage API docs, and [EngageServiceWorker](https://github.com/googlesamples/engage-sdk-samples/blob/main/watch/app/src/main/java/com/google/samples/quickstart/engagesdksamples/watch/publish/EngageServiceWorker.kt) is the worker which does the publishing.\n- [ItemToEntityConverter](https://github.com/googlesamples/engage-sdk-samples/blob/main/watch/app/src/main/java/com/google/samples/quickstart/engagesdksamples/watch/data/converters/ItemToEntityConverter.kt) contains methods to build an Entity for publishing. This class is useful to show how to construct an entity from the data that already exists in your application.\n\n| **Note:** The sample app uses one worker for publishing, passing in flags indicating which cluster to publish. Depending on your app architecture, you might choose to use multiple workers.\n\n[Link to Engage SDK Watch Sample App on Github](https://github.com/googlesamples/engage-sdk-samples/tree/main/watch)\n\nAdditional Tips\n---------------\n\nHere are some additional tips for using the Engage SDK sample apps:\n\n- Use the sample apps to understand how to call specific Engage SDK APIs in your app.\n- Experiment with different features of the Engage SDK.\n\nSupport\n-------\n\nContact [engage-developers@google.com](mailto:engage-developers@google.com)\nif you have any questions that are not covered here."]]