Class CronetEngineWrapper


  • public final class CronetEngineWrapper
    extends Object
    A wrapper class for a CronetEngine.
    • Field Detail

      • SOURCE_NATIVE

        public static final int SOURCE_NATIVE
        Natively bundled Cronet implementation.
        See Also:
        Constant Field Values
      • SOURCE_GMS

        public static final int SOURCE_GMS
        Cronet implementation from GMSCore.
        See Also:
        Constant Field Values
      • SOURCE_UNKNOWN

        public static final int SOURCE_UNKNOWN
        Other (unknown) Cronet implementation.
        See Also:
        Constant Field Values
      • SOURCE_USER_PROVIDED

        public static final int SOURCE_USER_PROVIDED
        User-provided Cronet engine.
        See Also:
        Constant Field Values
      • SOURCE_UNAVAILABLE

        public static final int SOURCE_UNAVAILABLE
        No Cronet implementation available. Fallback Http provider is used if possible.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CronetEngineWrapper

        public CronetEngineWrapper​(Context context)
        Creates a wrapper for a CronetEngine built using the most suitable CronetProvider. When natively bundled Cronet and GMSCore Cronet are both available, the natively bundled provider is preferred.
        Parameters:
        context - A context.
      • CronetEngineWrapper

        public CronetEngineWrapper​(Context context,
                                   @Nullable
                                   String userAgent,
                                   boolean preferGMSCoreCronet)
        Creates a wrapper for a CronetEngine built using the most suitable CronetProvider. When natively bundled Cronet and GMSCore Cronet are both available, preferGMSCoreCronet determines which is preferred.
        Parameters:
        context - A context.
        userAgent - A default user agent, or null to use a default user agent of the CronetEngine.
        preferGMSCoreCronet - Whether Cronet from GMSCore should be preferred over natively bundled Cronet if both are available.
      • CronetEngineWrapper

        public CronetEngineWrapper​(org.chromium.net.CronetEngine cronetEngine)
        Creates a wrapper for an existing CronetEngine.
        Parameters:
        cronetEngine - The CronetEngine to wrap.