Mẫu này cho thấy trạng thái nhiệt của thiết bị bằng cách sử dụng API getThermalHeadroom của ADPF và API trạng thái nhiệt. Ứng dụng cũng thay đổi mức tải một cách linh động dựa trên khoảng nhiệt và API Trình quản lý gợi ý về hiệu suất để kiểm soát hiệu suất của luồng kết xuất hình ảnh.
Lớp học lập trình
Lớp học lập trình Tích hợp các tính năng về Khả năng thích ứng vào Trò chơi C++ hướng dẫn bạn tích hợp các tính năng ADPF vào trò chơi của mình bằng các bước đơn giản mà bạn có thể làm theo theo tốc độ của riêng mình. Khi kết thúc lớp học lập trình, bạn sẽ tích hợp các tính năng sau và hiểu rõ hơn về chức năng của các tính năng đó:
API nhiệt: theo dõi tình trạng nhiệt của thiết bị và phản ứng trước khi thiết bị rơi vào trạng thái điều tiết nhiệt.
Game Mode API (API Chế độ trò chơi): hiểu lựa chọn ưu tiên về tối ưu hoá của người chơi (tối đa hoá hiệu suất hoặc tiết kiệm pin) và điều chỉnh cho phù hợp.
Game State API (API Trạng thái trò chơi): cho hệ thống biết trạng thái của trò chơi (đang tải, đang chơi, giao diện người dùng, v.v.) và hệ thống có thể điều chỉnh tài nguyên cho phù hợp (tăng cường I/O hoặc CPU, GPU, v.v.).
Performance Hint API (API Gợi ý về hiệu suất): cho hệ thống biết mô hình phân luồng cũng như khối lượng công việc của bạn để hệ thống có thể phân bổ tài nguyên cho phù hợp.
Hình 2.Biểu đồ thông tin về lớp học lập trình ADPF
Câu chuyện của nhà phát triển
Hãy xem cách các nhà phát triển trò chơi tăng độ ổn định của FPS và tối ưu hoá mức tiêu thụ điện năng bằng cách sử dụng API Khả năng thích ứng trong những câu chuyện thành công sau đây của nhà phát triể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-26 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-26 UTC."],[],[],null,["# Sample, Codelab and Developer Stories\n\nSample App\n----------\n\nThe [ADPF sample app](https://github.com/android/games-samples/tree/main/agdk/adpf)\ndemonstrates the basic use of the ADPF API.\n**Figure 1.** ADPF Demo Game Application\n\nThe sample displays the device's thermal status using the ADPF\n[`getThermalHeadroom`](/reference/android/os/PowerManager#getThermalHeadroom(int))\nAPI and the [thermal status](/reference/android/os/PowerManager.OnThermalStatusChangedListener)\nAPI. The app also dynamically changes the workload based on the Thermal headroom\nand the [Performance Hint Manager API](/reference/android/os/PerformanceHintManager)\nto control render thread performance.\n\nCodelab\n-------\n\nThe [Integrating Adaptability Features Into Your C++ Game](/adaptability-codelab)\ncodelab guides you to integrate ADPF features into your game with simple steps\nthat you can follow at your own pace. At the end of the codelab, you will have\nintegrated the following features and will better understand their\nfunctionalities:\n\n- [Thermal API](/games/optimize/adpf#thermal): listen to device thermal condition and react before the device falls into thermal throttling state.\n- [Game Mode API](/games/optimize/adpf/gamemode/about-API-and-interventions): understand player's optimization preference (maximize performance or preserving battery) and adjust accordingly.\n- [Game State API](/reference/android/app/GameState): let the system know the state of your game (loading, playing, UI, etc) and the system can adjust resources accordingly (boost I/O, or CPU, GPU, etc).\n- [Performance Hint API](/reference/android/os/PerformanceHintManager): let the system know your threading model and workload so that the system can allocate resources accordingly.\n\n**Figure 2.**ADPF Codelab Infographic\n\nDeveloper Stories\n-----------------\n\nCheck out how game developers increased their FPS stability and optimize their\npower consumption using Adaptability APIs in these developer success stories!\n\n- [Kakao Games increased FPS stability to 96% through Android Adaptability](/stories/games/kakaogames-adaptability)\n- [Gameloft reduces device power consumption by 70%, resulting in 35% longer play time with the Game Mode API](/stories/games/gameloft-gamemode)\n- [Android Game Development Kit (AGDK) update: Adaptability and performance features](https://www.youtube.com/watch?v=_-FwUrQAsVg)\n- [GDC Vault - Google Developer Summit: Improving Game Performance with Android Dynamic Performance Framework](https://www.gdcvault.com/play/1029174/Google-Developer-Summit-Improving-Game)\n- [MediaTek enhances dynamic performance of Android SoCs](/stories/games/mediatek-adpf)\n- [NCSoft Lineage W improves sustained performance and prevents thermal throttling by using ADPF](/stories/games/lineagew-adpf)\n- [ARM getting started with Android Dynamic Performance Framework (ADPF) in Unreal Engine](/stories/games/arm-adpf)\n- [Netmarble Games: Optimizing Performance with ADPF](/stories/games/netmarble-got-adpf)"]]