# Publish a private app

Apps published through the Google Play Custom App Publishing API can never be
made public. They're subject to a lighter weight verification process than
public apps as a result, reducing publishing time to as little as five minutes
(compared to over two hours via the Play Console).

To publish a private app for an enterprise, call
[`Accounts.customApps.create`](https://developers.google.com/android/work/play/custom-app-api/v1/accounts/customApps/create),
passing the enterprise's developer account ID as a parameter. The only required fields in
the request body are the title of the app and the app's default listing
language. Make sure that any private app you publish also meets the following
requirements:

- The package name is unique to Google Play (not just unique to the developer account).
- The title of the app is unique to the developer account.

## Example

    Path apkPath = Paths.get("PATH_TO_APK");
    ByteArrayContent apk =
        new ByteArrayContent("application/octet-stream", Files.readAllBytes(apkPath));

    CustomApp appMetadata =
        new CustomApp()
          .setTitle("APPLICATION TITLE")
          .setLanguageCode("en_US")
          .setOrganizations(
              List.of(
                  new CustomAppOrganization()
                      .setOrganizationId("C0123wxyz")
                      .setOrganizationName("My organization")));

    CustomApps.Create request =
        apiClient.accounts() // Playcustomapp apiClient
          .customApps()
          .create(DEV_ACCOUNT_ID, appMetadata, apk);

    CustomApp response = request.execute();
    System.out.println(response);

If successful, the app will appear in the developer account's list of published
apps in the Play Console immediately. The app will be available for distribution
to end users within five minutes.

By default, the published private app is only available to the organization
linked to the developer account. To set the organizations to which the
private app should be made available, add the organization IDs to the
`organizations` property.

### Distributing private apps

> [!NOTE]
> **Note:** You must be a member of the [Android EMM Developer
> Community](https://emm.androidenterprise.dev/) to use the Google Play EMM API to enable private app distribution. For more information, see the [EMM developer's
> overview](https://developers.google.com/android/work/overview).

Private apps are automatically approved when published, but aren't automatically
available to a user unless an enterprise IT admin explicitly grants them access
to all approved apps. You can enable this feature in your EMM Console using
`https://developers.google.com/android/work/play/emm-api/v1/users/setAvailableProductSet`
(set `productSetBehavior` to `"allApproved"`).

You can also use the same call to enable IT admins to allowlist specific apps
for a user (set `productSetBehavior` to `"whitelist"`).
For more information about how to add apps to a user's managed Google Play store,
see [Create custom store layouts](https://developers.google.com/android/work/play/emm-api/store-layout).

## Updating a private app

To provide the best possible user experience for your enterprise customers,
we recommend integrating private app publishing alongside the app and store
listing update features available through the [Google Play Publishing API](https://developers.google.com/android-publisher/).
Doing so gives IT admins the ability to publish, edit, and update private apps
directly from your EMM console or IDE. You can use the same service account that
you created for private app publishing to authorize Google Play Publishing API
requests.

You or your enterprise customer can also update private apps and their store
listing details from the Play Console (for more information, see the [Play Console help center](https://support.google.com/googleplay/android-developer/)).

## Start coding with our client libraries

Client libraries for the Google Play Custom App Publishing API are available in
[Java](https://developers.google.com/api-client-library/java/apis/playcustomapp/v1),
[Python](https://developers.google.com/api-client-library/python/apis/playcustomapp/v1),
[.NET](https://developers.google.com/api-client-library/dotnet/apis/playcustomapp/v1),
and [Ruby](https://developers.google.com/api-client-library/ruby/apis/playcustomapp/v1).

## Learn more about Android Enterprise

- For more information about developing an EMM solution for Android, see [Android Enterprise](https://developers.google.com/android/work/).
- For information about best practices for developing Android apps for enterprise distribution, see [Android for
  enterprise](https://developer.android.com/work/).