An Enterprise
resource binds an organization to your Android Management solution.
Devices
and Policies
both belong to an enterprise. Typically, a single enterprise resource is
associated with a single organization. However, you can create multiple
enterprises for the same organization based on their needs. For example, an
organization may want separate enterprises for its different departments or
regions.
The basic steps on how to create an enterprise are described in the Quickstart guide. This page outlines the process in more detail. There are two ways to create an enterprise:
- Customer-managed enterprise:
This is the recommended way to create an enterprise. Do not set the
agreementAccepted
query parameter and thecontactInfo
field when calling the 'enterprises.create' method. - EMM-managed enterprise:
This is not the preferred method to create an enterprise, but it is still
possible to create and manage an EMM-managed enterprise using this method. Set
the
agreementAccepted
query parameter and thecontactInfo
field when calling the 'enterprises.create' method.
Customer-managed enterprises
This is the preferred method to create an enterprise and it is further explained as follows:
1. Retrieve the sign up url
Call signupUrls.create
to retrieve the sign up URL and specify the following two parameters:
callbackUrl
: An https URL the setup wizard redirects to after enterprise sign up is complete. This is typically your management console.projectId
: Your project ID.
The response contains a url
and name
. Open the url
and note the name
.
2. Enterprise IT admin completes the sign up flow
The url
guides the enterprise admin through the enterprise sign-up process.
They need a Gmail account that's not already associated with an enterprise.
After successfully registering their enterprise, the sign-up flow redirects to
your callbackUrl
. An enterpriseToken
is appended to the
callbackUrl
.
Example
https://example.com/?enterpriseToken=EAH2pBTtGCs2K28dqhq5uw0uCyVzYMqGivap4wdlH7KNlPtCmlC8uyl
3. Create an enterprise
To create an enterprise, call
enterprises.create
.
In addition to creating a unique enterprise ID, this method allows you to define
certain enterprise-specific settings. For instance, you can set the predominant
color displayed during device provisioning (primaryColor
), along
with the name or title (enterpriseDisplayName
) and logo
(logo
) that’s shown to end users.
Example
The following examples uses the Java client library to create an enterprise and return its name. See the sample page for more details about using the library.
private String createEnterprise(AndroidManagement androidManagementClient) throws IOException { SignupUrl signupUrl = androidManagementClient .signupUrls() .create() .setProjectId("myProject") .setCallbackUrl("https://example.com/myEmmConsole") .execute(); String enterpriseToken = displayUrlToAdmin(signupUrl.getUrl()); Enterprise enterprise = androidManagementClient .enterprises() .create(new Enterprise()) .setProjectId("myProject") .setSignupUrlName(signupUrl.getName()) .setEnterpriseToken(enterpriseToken) .execute(); return enterprise.getName(); } /** * Displays the signup URL to the admin and returns the enterprise token which * is generated after the admin goes through the signup flow. This functionality * must be implemented by your management console. */ private String displayUrlToAdmin(String url) { ... }
EMM-managed enterprises
This is no longer the recommended way to create an enterprise. With this method, EMMs have control over the full lifecycle of an enterprise. Make sure to review the Terms of Service, which includes things like what information to collect, and your obligations to your customers for this feature, to ensure your solution meets all requirements of the API. Some of those details are highlighted below:
1. Pre-requisites
- Collect the enterprise admin's email address.
- Allow your customer to provide you with the contact information for their
data protection officer and European Union representative. You must also
allow the customer to modify the contact information, and if they do,
communicate the new contact information to Google (with
enterprises.patch
). - Show the enterprise admin the Managed Google Play Agreement, and record the identity of the customer and user, and the date and time of the acceptance in your own system.
2. Create the enterprise
To create an enterprise, call
enterprises.create
,
passing the following values:
- Set
agreementAccepted
totrue
, based on completion of step 3 in the pre-requisites. - Set
contactInfo
in theEnterprise
resource using the contact details you collected from the enterprise admin in steps 1 and 2. Note that thecontactEmail
is required. This may include:{ "contactEmail": string, "dataProtectionOfficerName": string, "dataProtectionOfficerEmail": string, "dataProtectionOfficerPhone": string, "euRepresentativeName": string, "euRepresentativeEmail": string, "euRepresentativePhone": string }
- In addition to creating a unique enterprise ID, this method allows you to
define certain enterprise-specific settings. For instance, you can set the
predominant color to display in the device management app UI (
primaryColor
), along with the name or title (enterpriseDisplayName
) and logo (logo
) shown to end users.
You are responsible for the lifecycle - creating, updating, and deleting - of
the enterprise. You can now update it using
enterprises.patch
and delete it using
enterprises.delete
.
You must delete the enterprise when your customer terminates their
relationship with you.
3. Update and list your enterprises
In order to change the contactInfo
for an enterprise, call
enterprises.patch
,
and set contactInfo
in the Enterprise
resource. Please note the following:
- If
update_mask
includescontactInfo
and you pass an emptycontactInfo
value, the call will fail. - If
update_mask
is not set andcontactInfo
is omitted, no change will be made tocontactInfo
.
To retrieve a list of all your EMM-managed enterprises, call
enterprises.list
.
The response only contains these fields for each
enterprise:
name
: The name of the enterprise in the formenterprises/{enterpriseId}
.enterpriseDisplayName
: The name of the enterprise displayed to users.
To retrieve the other fields, call
enterprises.get
with
a specific enterprise's name
.
Example
The following examples uses the Java client library to create an enterprise and return its name. See the sample page for more details about using the library.
To create an enterprise:
private String createEnterprise(AndroidManagement androidManagementClient) throws IOException { ContactInfo contactInfo = new ContactInfo(); contactInfo.setContactEmail("contact@example.com"); contactInfo.setDataProtectionOfficerName("John Doe"); contactInfo.setDataProtectionOfficerEmail("dpo@example.com"); contactInfo.setDataProtectionOfficerPhone("+33 1 99 00 98 76 54"); contactInfo.setEuRepresentativeName("Jane Doe"); contactInfo.setEuRepresentativeEmail("eurep@example.com"); contactInfo.setEuRepresentativePhone("+33 1 99 00 12 34 56"); Enterprise enterprise = new Enterprise(); enterprise.setEnterpriseDisplayName("Example Enterprise"); Enterprise enterprise = androidManagementClient .enterprises() .create(enterprise) .setProjectId("myProject") .setContactInfo(contactInfo) .setAgreementAccepted(true) .execute(); return enterprise.getName(); }
To delete an enterprise:
private void deleteEnterprise(AndroidManagement androidManagementClient, String enterpriseName) throws IOException { Enterprise enterprise = new Enterprise(); // The enterprise name is in the form of enterprises/{enterpriseId} enterprise.setName(enterpriseName); Enterprise enterprise = androidManagementClient .enterprises() .delete(enterprise) .execute(); }