Skip to content

Conversation

yschimke
Copy link
Collaborator

@yschimke yschimke commented Apr 20, 2024

Cleanly pinning network on Android - #8286

val pinning = AndroidNetworkPinning()
val client = OkHttpClient.Builder().addCallDecorator(pinning).build()

// clean up lost networks
connectivityManager.registerNetworkCallback(NetworkRequest.Builder().build(), pinning.networkCallback)

// Substitute in some preferred network here
val activeNetwork = connectivityManager.activeNetwork

val request = Request.Builder()
  .url(server.url("/"))
  .tag<Network>(activeNetwork)
  .build()

To land after #8800

@yschimke yschimke requested a review from swankjesse April 20, 2024 11:46
@yschimke yschimke added the android Relates to usage specifically on Android label Apr 20, 2024
@yschimke yschimke marked this pull request as ready for review April 20, 2024 17:18
@yschimke yschimke changed the title Draft of network pinning on Android OkHttpClient.Builder network pinning on Android Apr 20, 2024
@yschimke yschimke requested a review from JakeWharton January 4, 2025 11:03
@yschimke yschimke marked this pull request as draft May 26, 2025 12:21
@yschimke

This comment was marked as outdated.

@yschimke yschimke added this to the 5.x milestone Jun 22, 2025
@yschimke yschimke changed the title OkHttpClient.Builder network pinning on Android Call.Decorator network pinning on Android Aug 2, 2025
@yschimke yschimke force-pushed the clean_pin_network branch from 4aaffaa to eb1412c Compare August 2, 2025 10:28
@yschimke yschimke marked this pull request as ready for review August 2, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Relates to usage specifically on Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants