Skip to main content
Christophe
New Member
June 23, 2026
Question

AMAPI managed Google account setup reliability issues using a Custom DPC

  • June 23, 2026
  • 0 replies
  • 11 views

Hi everyone,

We are currently facing many difficulties setting up managed Google accounts using the AMAPI library with our Custom DPC.

At the beginning, we were doing everything from a single Activity: calling prepareEnvironment() and then starting the managed Google account setup flow. However, we encountered many reliability issues with this approach.

We then changed the implementation to use a chain of Workers:

  • one Worker calls prepareEnvironment();

  • another Worker starts an Activity responsible for performing the account setup.

Each Worker can retry up to 3 times when needed. This improved the success rate, but we still have many failures with different types of errors.

The most frequent one is:

ApiException: 13

Most of the time, this one eventually succeeds after the Worker retries.

However, depending on the device, and sometimes randomly on the same device, we also get other errors, such as:

  • AndroidDevicePolicyInstallOrUpdateUnrecoverableException

  • SecurityException — this one happens less often recently

  • AccountSetupAttemptAlreadyInProgressException

I also implemented logic to cancel existing account setup attempts before starting a new setup, but this has never worked reliably on our side. In some cases, cancelAccountSetupAttempt() fails with:

UNKNOWN: Failed to cancel account setup attempt

I would like to know if other EMM providers or Custom DPC developers are experiencing similar issues when using prepareEnvironment() or setting up managed Google accounts with AMAPI.

Is this a known reliability issue, or is it more likely to be an implementation problem on our side?

We have been working on this topic for several months and have already opened multiple support tickets. The only noticeable improvement so far is that SecurityException now happens much less frequently, but the overall flow is still not reliable enough for production use.

This is becoming a critical topic for us, so any feedback, implementation advice, or shared experience would be very helpful.

Thanks in advance.