11gRPC Cronet Transport
22========================
33
4- ** EXPERIMENTAL:** * gRPC's Cronet transport is an experimental API, and is not
5- yet integrated with our build system. Using Cronet with gRPC requires manually
6- integrating the gRPC code in this directory into your Android application.*
4+ ** EXPERIMENTAL:** * gRPC's Cronet transport is an experimental API, its stability
5+ depends on upstream Cronet's implementation, which involves some experimental features.*
76
87This code enables using the [ Chromium networking stack
98(Cronet)] ( https://chromium.googlesource.com/chromium/src/+/master/components/cronet )
@@ -17,13 +16,26 @@ Some advantages of using Cronet with gRPC:
1716* Robust to Android network connectivity changes
1817* Support for [ QUIC] ( https://www.chromium.org/quic )
1918
20- Cronet jars are available on Google's Maven repository. See the example app at
21- https://github.com/GoogleChrome/cronet-sample/blob/master/README.md . To use
22- Cronet with gRPC, you will need to copy the gRPC source files contained in this
23- directory into your application's code, as we do not currently provide a
24- ` grpc-cronet ` dependency.
19+ Since gRPC's 1.24 release, the ` grpc-cronet ` package provides access to the
20+ ` CronetChannelBuilder ` class. Cronet jars are available on Google's Maven repository.
21+ See the example app at https://github.com/GoogleChrome/cronet-sample/blob/master/README.md .
2522
26- To use Cronet, you must have the ` ACCESS_NETWORK_STATE ` permission set in
23+ ## Example usage:
24+
25+ In your app module's ` build.gradle ` file, include a dependency on both ` grpc-cronet ` and the
26+ Google Play Services Client Library for Cronet
27+
28+ ```
29+ implementation 'io.grpc:grpc-cronet:1.24.0'
30+ implementation 'com.google.android.gms:play-services-cronet:16.0.0'
31+ ```
32+
33+ In cases where Cronet cannot be loaded from Google Play services, there is a less performant
34+ implementation of Cronet's API that can be used. Depend on ` org.chromium.net:cronet-fallback `
35+ to use this fall-back implementation.
36+
37+
38+ You will also need permission to access the device's network state in your
2739` AndroidManifest.xml ` :
2840
2941```
0 commit comments