Package com.google.android.exoplayer2.ext.cronet

## Class CronetUtil

- java.lang.Object
- - com.google.android.exoplayer2.ext.cronet.CronetUtil

-     public final class CronetUtil
      extends Object

  Cronet utility methods.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static org.chromium.net.CronetEngine` | `buildCronetEngine​(Context context, String userAgent, boolean preferGooglePlayServices)` | Builds a `CronetEngine` suitable for use with ExoPlayer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### buildCronetEngine

          @Nullable
          public static org.chromium.net.CronetEngine buildCronetEngine​(Context context,
                                                                        @Nullable
                                                                        String userAgent,
                                                                        boolean preferGooglePlayServices)

      Builds a `CronetEngine` suitable for use with ExoPlayer. When choosing a `Cronet provider` to build the `CronetEngine`, disabled providers are not considered. Neither are fallback providers, since it's more efficient to use `DefaultHttpDataSource` than it is to use `CronetDataSource` with a fallback `CronetEngine`.

      Note that it's recommended for applications to create only one instance of `CronetEngine`, so if your application already has an instance for performing other networking, then that instance should be used and calling this method is unnecessary. See the Android developer guide to learn more about using Cronet for network operations.

      Parameters:
        `context` - A context.
        `userAgent` - A default user agent, or `null` to use a default user agent of the `CronetEngine`.
        `preferGooglePlayServices` - Whether Cronet from Google Play Services should be preferred over Cronet Embedded, if both are available.
      Returns:
        The `CronetEngine`, or `null` if no suitable engine could be built.