Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Le SDK de l'API Android Management (AMAPI) permet à des applications spécifiques de communiquer directement avec Android Device Policy (ADP). Il est compatible avec les éléments suivants :
Assurez-vous que le minSdkVersion de votre application est défini sur le niveau d'API 21 au minimum.
Ajoutez les dépendances de la dernière version du SDK AMAPI à votre application. Vous trouverez la version de la dernière bibliothèque disponible et la procédure pour l'ajouter à votre application sur la page des notes de version du SDK AMAPI.
Ajouter un élément de requête
Si votre application cible le SDK 30 ou une version ultérieure, l'élément "queries" est nécessaire dans AndroidManifest.xml pour spécifier qu'elle interagira avec ADP.
Certaines fonctionnalités nécessitent la création d'un NotificationReceiverService, tandis que d'autres peuvent l'utiliser de manière facultative. Pour l'utiliser, définissez une classe étendant NotificationReceiverService, ajoutez-la en tant que service à votre AndroidManifest.xml et assurez-vous qu'elle est exportée.
importcom.google.android.managementapi.notification.NotificationReceiverService;...publicfinalclassMyAppNotificationReceiverServiceextendsNotificationReceiverService{@OverrideprotectedvoidsetupInjection(){// This method can be optionally used to inject dependencies at the// beginning of the service lifecycle.}}
En règle générale, le ComponentName de votre classe qui implémente NotificationReceiverService doit nous être transmis via une API appropriée.
Les détails varient en fonction de la fonctionnalité concernée, et chaque fonctionnalité qui en a besoin est documentée.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/24 (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/07/24 (UTC)."],[],[],null,["The [Android Management API (AMAPI) SDK](https://maven.google.com/web/index.html#com.google.android.libraries.enterprise.amapi) enables specific apps to\ncommunicate directly with Android Device Policy (ADP). It includes support for:\n\n- [Local execution of Commands](/android/management/sdk-local-commands).\n- [Migrate devices managed with a custom DPC to AMAPI](/android/management/dpc-migration)\n- [Device Trust from Android Enterprise](/android/management/device-trust-api)\n\nThe following steps must be taken to integrate the AMAPI SDK with your\napplication:\n\n1. [Add the AMAPI SDK library](/android/management/sdk-release-notes#declare_dependencies).\n2. [Add the queries element](#add_queries), if target SDK \\\u003e= 30.\n\n| **Note:** If you are developing an extension app, you will also need to provision the device with an [extensibility policy](/android/management/sdk-local-commands#policy).\n\nPrerequisites\n\n- Ensure that your app's `minSdkVersion` is set to at least API level 21.\n- Add the dependencies for the latest version of the AMAPI SDK to your application. You can find the version of the latest available library, and how to add it to your application, in the [AMAPI SDK's release notes](/android/management/sdk-release-notes) page.\n\nAdd queries element\n\nIf your app targets SDK 30 or later, then queries element is needed in the\n`AndroidManifest.xml` to specify that it will interact with ADP. \n\n \u003cqueries\u003e\n \u003cpackage android:name=\"com.google.android.apps.work.clouddpc\" /\u003e\n \u003c/queries\u003e\n\nSee [Package visibility filtering on Android](https://developer.android.com/training/package-visibility) for more information.\n\nImplement a NotificationReceiverService\n\nSome features require creating a\n[`NotificationReceiverService`](/android/management/reference/amapi/com/google/android/managementapi/notification/NotificationReceiverService), and some features\nmake optional use of it. To use it, define a class extending\n`NotificationReceiverService`, add it as a `service` to your\n`AndroidManifest.xml`, and make sure it is exported. \n\n\n import com.google.android.managementapi.notification.NotificationReceiverService;\n\n ...\n\n public final class MyAppNotificationReceiverService extends NotificationReceiverService {\n\n @Override\n protected void setupInjection() {\n // This method can be optionally used to inject dependencies at the\n // beginning of the service lifecycle.\n }\n }\n\nIn your `AndroidManifest.xml`, add \n\n \u003cservice\n android:name = \".MyAppNotificationReceiverService\"\n android:exported = \"true\" /\u003e\n\nTypically the `ComponentName` of your class which implements\n`NotificationReceiverService` needs to be passed to us through a suitable API.\nThe details vary depending on the feature in question, and each feature which\nneeds this documents it."]]