public class

AmazonWebKitFactories

extends Object
java.lang.Object
   ↳ com.amazon.android.webkit.AmazonWebKitFactories

Class Overview

Selects which AmazonWebKitFactory implementation to use.

The currently supported factory implementations are:

Summary

Constants
String ANDROID_FACTORY Specifies that the Android WebKit implementation is used as the backing implementation of the web view.
String EMBEDDED_FACTORY Specifies that the Chromium-based implementation is used as the backing implementation of the web view.
Public Constructors
AmazonWebKitFactories()
Public Methods
static AmazonWebKitFactory getDefaultFactory()
Retrieves an object containing the default factory implementation.
static int getDefaultFactoryMaxApiLevelSupported()
Get the maximum API level support provided by the default factory.
static void setDefaultFactory(String factory)
Set the factory implementation to use by default.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ANDROID_FACTORY

Specifies that the Android WebKit implementation is used as the backing implementation of the web view.

Constant Value: "com.amazon.android.webkit.android.AndroidWebKitFactory"

public static final String EMBEDDED_FACTORY

Specifies that the Chromium-based implementation is used as the backing implementation of the web view.

Constant Value: "com.amazon.android.webkit.embedded.EmbeddedWebKitFactory"

Public Constructors

public AmazonWebKitFactories ()

Public Methods

public static AmazonWebKitFactory getDefaultFactory ()

Retrieves an object containing the default factory implementation.

An EMBEDDED_FACTORY will only be returned when the method is called on third-generation Kindle Fire tablets. ANDROID_FACTORY is only available if the awv_android_factory.jar is included with the compiled application.

If your application calls the method on an Android device, and you have not included the awv_android_factory.jar, getDefaultFactory() throws a RuntimeException.

Returns
  • The backing implementation for the WebView.

public static int getDefaultFactoryMaxApiLevelSupported ()

Get the maximum API level support provided by the default factory. This method can be invoked before the factory object is created. If you find that the max API Level is lower than the API Level that your application is targeted for, you have one of two choices: 1. Conditionally invoke newer APIs based the API Level available on the device. See documentation getApiLevel() for a sample code on how to accomplish this. 2. Exit your application. See code snippet below. The following sample code gets the available API Level and quits if it doesn't find the API Level that the application is compiled for.

 if (AmazonWebKitFactories.getDefaultFactoryMaxApiLevelSupported() < AmazonApiLevels.AWV_LEVEL_MAX) {
      // Let the user know that you can't run
      // Quit the app
   

Returns
  • Max API Level available on the device.
Throws
RuntimeException if API level couldn't be determined.

public static void setDefaultFactory (String factory)

Set the factory implementation to use by default. To set the default factory, this method must be called before the first call to the getDefaultFactory() method. Once the getDefaultFactory() is called, subsequent calls to the setDefaultFactory(String) method result in an IllegalStateException being thrown.

Parameters
factory Fully qualified class name for the factory. For example, com.amazon.android.webkit.android.AndroidWebKitFactory
Throws
java.lang.IllegalStateException
IllegalStateException