-
Notifications
You must be signed in to change notification settings - Fork 209
Description
Looking to set a custom url as a default host for analytics, in the source there appears to be two ways to do this: by overriding the connection factory or by setting a defaultApiHost in the builder.
While setting the defaultApiHost will correctly update to the custom url, this code found in the analytics constructor that sets the apiHostSet will always yield true. It appears that the value for projectSettings/integrations/Segment.io returns api.segment.io/v1 despite the defaultApiHost override.
Below is a sample of the analytics constructor in the project written in Kotlin.
// uses defaultApiHost
Analytics.Builder(application, WRITE_KEY)
.use(AmplitudeIntegration.FACTORY)
.trackApplicationLifecycleEvents()
.defaultApiHost(HOST_URL)
.build()
// override connection factory
Analytics.Builder(application, WRITE_KEY)
.use(AmplitudeIntegration.FACTORY)
.trackApplicationLifecycleEvents()
.connectionFactory(object : ConnectionFactory() {
@throws(IOException::class)
override fun openConnection(url: String): HttpURLConnection {
return super.openConnection(HOST_URL)
}
})
.build()
The Android Studio debugger for projectSettings:

Are there any additional requirements needed to properly set the correct apiHost ? Looking for more context based on the source code.