FakeSplitInstallManagerFactory

public class FakeSplitInstallManagerFactory
extends Object

java.lang.Object
   ↳ com.google.android.play.core.splitinstall.testing.FakeSplitInstallManagerFactory


Creates instances of FakeSplitInstallManager.

Summary

Public constructors

FakeSplitInstallManagerFactory()

Public methods

static FakeSplitInstallManager create(Context context, File modulesDirectory)

Creates a fake implementation of the SplitInstallManager.

Inherited methods

From class java.lang.Object

Public constructors

FakeSplitInstallManagerFactory

FakeSplitInstallManagerFactory ()

Public methods

create

FakeSplitInstallManager create (Context context, 
                File modulesDirectory)

Creates a fake implementation of the SplitInstallManager.

This implementation is self-contained and obtains splits from a specified directory, which can be populated using the result of bundletool build-apks.

It is provided for testing, e.g. checking sequences of events when installing dynamic features and additional languages. It is suitable for use in integration tests.

This fake supports just one install request at a time.

The constructor receives the directory on the device where the split apks can be obtained. The file name format is the same as the extracted output of bundletool build-apks. The apks in the directory must be signed by the same certificate as the app. If this directory is missing, install requests will fail with API_NOT_AVAILABLE.

In general, all configuration splits for the module that are present in the folder will be included. Thus, consider pre-filtering them for the device - e.g. using appropriate bundletool build-apks argument. However, since languages can change over time on the device, there will be additional filtering of language splits, whereby only appropriate languages will be included.

Network errors can be simulated using setShouldNetworkError(boolean).

SplitCompat must be installed appropriately to use this class.

Parameters
context Context

modulesDirectory File

Returns
FakeSplitInstallManager