Skip to content

Support for alternative HTTP Clients #5568

Open
@yschimke

Description

@yschimke

What feature would you like to see?

CctTransportBackend.doSend() is hardcoded to use HttpURLConnection.

https://github.com/firebase/firebase-android-sdk/blob/master/transport/transport-backend-cct/src/main/java/com/google/android/datatransport/cct/CctTransportBackend.java

Ideally this would be easily configurable to share the HTTP Client with other parts of the app, such as image loaders, APIs (retrofit).

This is possible with URL.setURLStreamHandlerFactory to either Cronet or OkHttp (via ObsoleteUrlFactory)

While it seems possible to replace it via TransportBackendDiscovery in the manifest, it would duplicate a lot of code from CctTransportBackend.

How would you use it?

For Wear Apps, using OkHttp provides a centralised place to restrict requests when it isn't appropriate, such as avoiding using LTE and logging network traffic. OkHttp has event listeners and interceptors that allow such things.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions