firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Support for alternative HTTP Clients

Open yschimke opened this issue 1 year ago • 1 comments

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.

yschimke avatar Nov 22 '23 06:11 yschimke

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Nov 22 '23 06:11 google-oss-bot