Class CronetUtil


  • public final class CronetUtil
    extends Object
    Cronet utility methods.
    • 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.