Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment exécuter une application de surveillance. Une application de surveillance fait office de serveur local et affiche les données générées par une application Tuning Fork. Vous exécutez l'application de surveillance parallèlement à votre propre application pour vérifier qu'elle envoie correctement les données.
Activer un point de terminaison local dans Unity
Vous devez configurer votre application pour qu'elle transmette les données à un point de terminaison local situé sur l'appareil plutôt qu'aux serveurs Google Play. Pour activer un point de terminaison local, appelez EnableLocalEndpoint() avant d'appeler Start() dans le code de votre jeu :
tuner.EnableLocalEndpoint();
Ajoutez un indicateur dans votre fichier AndroidManifest.xml :
Ouvrez les paramètres de compilation Unity via File > Build Settings (Fichier > Paramètres de compilation).
Si ce n'est déjà fait, sélectionnez la plate-forme Android.
Cochez la case Export Project (Exporter le projet). La prochaine fois, lorsque vous compilerez le projet Unity, un projet Android sera créé.
Créez un projet Android via File > Build and Run(Fichier > Compiler et exécuter).
Ouvrez le fichier AndroidManifest.xml et ajoutez l'indicateur android:usesCleartextTraffic="true" :
Votre jeu envoie maintenant toutes les demandes à un point de terminaison local.
Exécuter votre application et l'application de surveillance
Procédez comme suit pour exécuter simultanément l'application de surveillance Tuning Fork et votre application afin de vérifier que cette dernière fonctionne correctement :
Installez l'APK de l'application de surveillance Tuning Fork sur l'appareil cible. Vous pouvez la compiler à partir de la page source de Tuning Fork Monitor.
Appuyez sur le bouton d'accueil d'Android pour envoyer l'application de surveillance Tuning Fork en arrière-plan sur l'appareil.
Exécutez votre application au premier plan pendant environ 30 secondes.
Revenez à l'application de surveillance Tuning Fork.
Le nom du package de votre application apparaît sous Live Applications (Applications en direct). Appuyez sur cette entrée pour afficher les informations relatives à l'application et la télémétrie en direct.
Figure 1. L'application de surveillance détecte l'application de démonstration.
Figure 2. L'application de surveillance affiche les données de l'application de démonstration.
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/26 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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"]]