onError

abstract fun onError(error: String)

Called when HMS push token retrieval fails.

This callback is executed on the main thread if token retrieval encounters an error. Common errors include missing agconnect-services.json configuration or HMS API failures.

Common error messages:

  • "Missing client/app_id key in agconnect-services.json" - Configuration error
  • "Status code: XXXX" - HMS API error (see Huawei documentation for error codes)
  • "Context is null" - Application context not available

Parameters

error

error message describing what went wrong