Skip to main content

Custom SDK Endpoint

How to configure a custom Appodeal SDK endpoint?

In some cases, the default Appodeal server endpoint may become unreachable in certain regions or locations. To resolve this, SDK 4.1.0 introduced the Set Endpoint API, which allows you to override the default server endpoint with a custom one provided by Appodeal support.

warning

Set Endpoint must be called before Appodeal initialization. If called after initialization, the endpoint change will be ignored.

API Reference

// Set custom endpoint before initialization
Appodeal.setEndpoint("https://provided-endpoint.example.com")

// Initialize SDK as usual
Appodeal.initialize(this, "YOUR_APP_KEY", adTypes)

// Verify the current endpoint (optional)
val currentEndpoint = Appodeal.getEndpoint()

Configuring Endpoint Remotely

We recommend managing the endpoint URL through a remote configuration service rather than hardcoding it. This allows you to update the endpoint without releasing a new version of your app.

The general approach is:

  1. Create a remote configuration parameter (e.g., appodeal_endpoint) with an empty default value.
  2. On app launch, fetch the configuration values.
  3. If the parameter is non-empty, call Set Endpoint with the fetched value before Appodeal initialization.

Firebase Remote Config

See Firebase Remote Config documentation for setup instructions.

val remoteConfig = Firebase.remoteConfig

// Set default value (empty string means use SDK default endpoint)
remoteConfig.setDefaultsAsync(mapOf("appodeal_endpoint" to ""))

remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
val endpoint = remoteConfig.getString("appodeal_endpoint")

if (endpoint.isNotEmpty()) {
Appodeal.setEndpoint(endpoint)
}

Appodeal.initialize(this, "YOUR_APP_KEY", adTypes)
}

AppMetrica Startup Parameters

See AppMetrica Startup Parameters usage examples for Android, iOS, and Unity.

val callback = object : StartupParamsCallback {
override fun onReceive(result: StartupParamsCallback.Result?) {
val endpoint = result?.parameterForKey("appodeal_endpoint") ?: ""

if (endpoint.isNotEmpty()) {
Appodeal.setEndpoint(endpoint)
}

Appodeal.initialize(this@MainActivity, "YOUR_APP_KEY", adTypes)
}

override fun onRequestError(
reason: StartupParamsCallback.Reason,
result: StartupParamsCallback.Result?
) {}
}

AppMetrica.requestStartupParams(this, callback, listOf("appodeal_endpoint"))

Important Notes

info
  • The custom endpoint URL will be provided by Appodeal support when needed — do not set arbitrary URLs.
  • Use Get Endpoint to verify the currently active endpoint for debugging purposes.