Class CronetUtil


  • @Deprecated
    public final class CronetUtil
    extends Object
    Deprecated.
    com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    Cronet utility methods.
    • Method Detail

      • buildCronetEngine

        @Nullable
        public static org.chromium.net.CronetEngine buildCronetEngine​(Context context)
        Deprecated.
        Builds a CronetEngine suitable for use with CronetDataSource. 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.
        Returns:
        The CronetEngine, or null if no suitable engine could be built.
      • buildCronetEngine

        @Nullable
        public static org.chromium.net.CronetEngine buildCronetEngine​(Context context,
                                                                      @Nullable
                                                                      String userAgent,
                                                                      boolean preferGooglePlayServices)
        Deprecated.
        Builds a CronetEngine suitable for use with CronetDataSource. 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.