Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a custom api host defaults in api.segment.io/v1 url #821

Open
talhapeloton opened this issue Jan 6, 2023 · 0 comments
Open

Setting a custom api host defaults in api.segment.io/v1 url #821

talhapeloton opened this issue Jan 6, 2023 · 0 comments

Comments

@talhapeloton
Copy link

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:
Screen Shot 2023-01-06 at 12 28 22 PM

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant