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.
Trang này mô tả cách chạy ứng dụng giám sát (monitoring app). Ứng dụng giám sát này hoạt động như một
máy chủ cục bộ và hiển thị dữ liệu mà một ứng dụng hỗ trợ Tuning Fork tạo ra. Bạn chạy ứng dụng giám sát này cùng với ứng dụng của riêng bạn để xác minh rằng ứng dụng đó
đang gửi dữ liệu đúng cách.
Bật một điểm cuối cục bộ trong Unity
Bạn cần định cấu hình ứng dụng để truyền dữ liệu đến một điểm cuối cục bộ trên
thiết bị chứ không phải trên máy chủ Google Play. Để bật điểm cuối cục bộ, hãy gọi
EnableLocalEndpoint()
trước khi gọi Start() trong mã trò chơi:
tuner.EnableLocalEndpoint();
Thêm cờ trong tệp AndroidManifest.xml:
Mở chế độ cài đặt bản dựng Unity (File (Tệp) > Build Settings (Cài đặt bản dựng)).
Cài đặt tệp APK ứng dụng Tuning Fork Monitor trên thiết bị mục tiêu. Bạn có thể tạo ứng dụng này từ trang nguồn Tuning Fork Monitor.
Nhấn nút Home (Màn hình chính) của Android để chuyển ứng dụng Tuning Fork Monitor xuống chạy nền trên thiết bị.
Chạy ứng dụng của bạn trong nền trước trong khoảng 30 giây.
Chuyển trở lại ứng dụng Tuning Fork Monitor.
Tên gói của ứng dụng xuất hiện trong Live Applications (Ứng dụng đang hoạt động). Nhấn vào mục này
để xem chi tiết ứng dụng và dữ liệu đo từ xa trực tiếp.
Hình 1. Ứng dụng giám sát phát hiện ứng dụng minh hoạ
Hình 2. Ứng dụng giám sát sẽ hiển thị dữ liệu từ ứng dụng minh hoạ
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-08-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-08-26 UTC."],[],[],null,["This page describes how to run a monitoring app. This monitoring app acts as a\nlocal server and displays the data that a Tuning Fork-enabled app\nproduces. You run the monitoring app alongside your own app to verify that it is\nproperly sending data.\n\nEnable a local endpoint in Unity\n\nYou need to configure your app to transmit data to a local endpoint on the\ndevice rather than Google Play servers. To enable a local endpoint, call\n[`EnableLocalEndpoint()`](/games/sdk/reference/performance-tuner/unity/class/google/android/performance-tuner/android-performance-tuner-t-fidelity-t-annotation-#enablelocalendpoint)\nbefore calling `Start()` in your game code: \n\n tuner.EnableLocalEndpoint();\n\nAdd a flag in your `AndroidManifest.xml` file:\n\n1. Open the Unity build settings (**File \\\u003e Build Settings**).\n2. If it's not selected yet, select the Android platform.\n3. Select the **Export Project** checkbox. The next time you build the Unity project, it creates an Android project.\n4. Build an Android project (**File \\\u003e Build and Run**).\n5. Open the `AndroidManifest.xml` file and add the flag `android:usesCleartextTraffic=\"true\"`:\n\n \u003capplication\n android:allowBackup=\"true\"\n android:icon=\"@mipmap/ic_launcher\"\n ...\n android:usesCleartextTraffic=\"true\"\n ...\n\nNow your game sends all requests to a local endpoint.\n\nRun your app and the monitor app\n\nFollow these steps to run the Tuning Fork Monitor app and your app at the same time\nto verify that your app is working properly:\n\n1. Connect a device (or [create a virtual device](/studio/run/managing-avds)) to run the apps. Enable [developer options and USB debugging](/studio/debug/dev-options#enable) on the device.\n2. Install the Tuning Fork Monitor app APK on the target device. You can build it from the [Tuning Fork Monitor source page](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/gamesdk-main/games-performance-tuner/tools/TuningForkMonitor/).\n3. Press the Android Home button to send the Tuning Fork Monitor app to the background on the device.\n4. Run your app in the foreground for about 30 seconds.\n5. Switch back to the Tuning Fork Monitor app.\n6. Your app's package name appears under **Live Applications**. Tap this entry to see app details and live telemetry.\n\n**Figure 1.** The monitor app detects the demo app \n**Figure 2.** The monitor app displays data from the demo app"]]