If your app makes a Play Integrity API request and the call fails, your app receives an error code. These errors can happen for various reasons, such as environmental issues like a poor network connection, problems with your API integration, or malicious activity and active attacks. The type of error code returned depends on the type of request:
- Standard requests: The API returns a StandardIntegrityErrorCode.
- Classic requests: The API returns a IntegrityErrorCode.
Retry strategies
Use exponential backoff for Play Integrity operations that happen in the background and don't affect the user experience while the user is in session.
For example, it is appropriate to implement this when acknowledging new purchases because this operation can happen in the background, and acknowledgment doesn't need to happen in real time if an error occurs.
After the first failure, start with an initial delay of 5 seconds before retrying.
Implement a retry strategy with a maximum number of attempts as an exit condition using an exponentially increased delay each time (10s, 20s).
While performing these retry attempts, check for a network connection and don't overload the device.
If you continue to see errors after three retry attempts, treat the outcome as if the client has failed all integrity checks. The error can be for several reasons, including (but not limited to): an overloaded device, network connection issues, or an attempt by an attacker.