# FakeSplitInstallManagerFactory

Summary:[Methods](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory#inhmethods)  

# FakeSplitInstallManagerFactory

`
public

final

class
FakeSplitInstallManagerFactory
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|----------------------------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)   ||
| ↳ | com.google.android.play.core.splitinstall.testing.FakeSplitInstallManagerFactory |

<br />

*** ** * ** ***

Creates instances of[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html).

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html) | ` `[create](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Creates a fake implementation of the[SplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/SplitInstallManager.html).                                                                                                                                                                                                                                                                                                                                                                                       |
| ` static `[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html) | ` `[create](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context,%20java.io.File))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[File](https://developer.android.com/reference/java/io/File.html)` modulesDirectory) ` Alternative version of[create(Context)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context))which allows for the splits directory to be set explicitly.                                                                                                                                                                                      |
| ` static `[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html) | ` `[createNewInstance](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#createNewInstance(android.content.Context,%20java.io.File))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[File](https://developer.android.com/reference/java/io/File.html)` modulesDirectory) ` Same functionality as[create(Context, File)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context,%20java.io.File))but always creates a new instance of the[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html)when called. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public methods

### create

```
public static FakeSplitInstallManager create (Context context)
```

Creates a fake implementation of the[SplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/SplitInstallManager.html).

This implementation is self-contained and obtains splits from a specified directory, which can be populated passing the`--local-testing`flag to`bundletool build-apks`and using`bundletool install-apks`to install the app.

If you are not using`--local-testing`, you should use the alternative factory method and provide the local module directory explicitly.

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.

Network errors can be simulated using[FakeSplitInstallManager.setShouldNetworkError(boolean)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html#setShouldNetworkError(boolean)).

[SplitCompat](https://developer.android.com/reference/com/google/android/play/core/splitcompat/SplitCompat.html)must be installed appropriately to use this class.

Installed splits are not persisted across application sessions: if you close and reopen an app using[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html), you need to request the splits again.

This method will always return the same[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html)instance. See[createNewInstance(Context, File)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#createNewInstance(android.content.Context,%20java.io.File)).

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

|                                                                          Returns                                                                          ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html) | <br /> |

### create

```
public static FakeSplitInstallManager create (Context context, 
                File modulesDirectory)
```

Alternative version of[create(Context)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context))which allows for the splits directory to be set explicitly.

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[SplitInstallErrorCode.API_NOT_AVAILABLE](https://developer.android.com/reference/com/google/android/play/core/splitinstall/model/SplitInstallErrorCode.html#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.

Prefer using[create(Context)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context))with bundletool in local-testing mode and let bundletool populate the default directory, unless there's a good reason to use a different directory or filter the delivered APKs by hand.

This method will always return the same[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html)instance. It will fail if called twice with different directories. See[createNewInstance(Context, File)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#createNewInstance(android.content.Context,%20java.io.File)).

<br />

|              Parameters              ||
|--------------------|------------------|
| `context`          | `Context` <br /> |
| `modulesDirectory` | `File` <br />    |

|                                                                          Returns                                                                          ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html) | <br /> |

### createNewInstance

```
public static FakeSplitInstallManager createNewInstance (Context context, 
                File modulesDirectory)
```

Same functionality as[create(Context, File)](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManagerFactory.html#create(android.content.Context,%20java.io.File))but always creates a new instance of the[FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html)when called.

<br />

|              Parameters              ||
|--------------------|------------------|
| `context`          | `Context` <br /> |
| `modulesDirectory` | `File` <br />    |

|                                                                          Returns                                                                          ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [FakeSplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/testing/FakeSplitInstallManager.html) | <br /> |