Integrate with the AMAPI SDK Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The AMAPI SDK allows specific apps to communicate with Android Device Policy and supports various features including local command execution, DPC migration, and managing apps and roles.
To integrate the AMAPI SDK, you need to add the library and the queries element if targeting SDK 30 or higher.
Implementing a
NotificationReceiverServiceis required for some features and can be done with either an Explicit API or Automatic discovery approach, both requiring the service to be exported.Your app must have a
minSdkVersionof at least API level 21.
TheAndroid Management API (AMAPI) SDK enables specific apps tocommunicate directly with Android Device Policy (ADP). It includes support for:
- Local execution of Commands
- Migrate devices managed with a custom DPC to AMAPI
- Device Trust from Android Enterprise
- New device enrollment flow that also supports adding managed Google Accounts
- Manage custom apps with AMAPI
- Manage application roles.
- Read device EID.
The following steps must be taken to integrate the AMAPI SDK with yourapplication:
- Add the AMAPI SDK library.
- Add the queries element, if target SDK >= 30.
Prerequisites
- Verify that your app's
minSdkVersionis set to at least API level 21. - Add the dependencies for the latest version of the AMAPI SDK to yourapplication. You can find the version of the latest available library, andhow to add it to your application, in theAMAPI SDK's release notespage.
Add queries element
If your app targets SDK 30 or later, then queries element is needed in theAndroidManifest.xml to specify that it will interact with ADP.
<queries><packageandroid:name="com.google.android.apps.work.clouddpc"/></queries>SeePackage visibility filtering on Android for more information.
Implement a NotificationReceiverService
Some features require creating aNotificationReceiverService, and some featuresmake optional use of it. To use it, define a class extendingNotificationReceiverService, add it as aservice to yourAndroidManifest.xml, and make sure it is exported.
importcom.google.android.managementapi.notification.NotificationReceiverService;...publicfinalclassMyAppNotificationReceiverServiceextendsNotificationReceiverService{@OverrideprotectedvoidsetupInjection(){// This method can be optionally used to inject dependencies at the// beginning of the service lifecycle.}}You must provide the ADP app with theComponentName of yourNotificationReceiverService class. There are two approaches for doing this.The documentation for each feature specifies which approach to use.
Explicit API
In this case, theComponentName is passed to the ADP app through a suitableAPI. The documentation of the feature in question has the details.In yourAndroidManifest.xml, add:
<serviceandroid:name=".MyAppNotificationReceiverService"android:exported="true"/>Automatic discovery
With this approach, you must tag your service so that it can be automaticallydiscovered. In yourAndroidManifest.xml, add:
<serviceandroid:name=".MyAppNotificationReceiverService"android:exported="true"><meta-dataandroid:name="Insertnamehere"android:value=""/></service>The specific string to use forandroid:name of themeta-data is documentedfor each feature which uses this approach (seeManage application roles for an example).For this tagging to be valid, your app must have exactly one service which isenabled and hasmeta-data whoseandroid:name is this specific string andandroid:value is an empty string. You can add multiplemeta-data to the sameservice.
android:exported set to true.Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-29 UTC.
