# SplitCompat

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

# SplitCompat

`
public


class
SplitCompat
`  
`

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.splitcompat.SplitCompat |

<br />

*** ** * ** ***

Enables immediate access to code and resources of split APKs installed through[SplitInstallManager](https://developer.android.com/reference/com/google/android/play/core/splitinstall/SplitInstallManager.html).

To learn more, read[Immediately access modules](https://d.android.com/guide/playcore/dynamic-delivery#access_downloaded_modules).

## Summary

|                                                                                                                                                                          ### Public methods                                                                                                                                                                           ||
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static boolean` | ` `[install](https://developer.android.com/reference/com/google/android/play/core/splitcompat/SplitCompat.html#install(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Emulates installation of split APKs to allow immediate access to their code and resources.          |
| ` static boolean` | ` `[installActivity](https://developer.android.com/reference/com/google/android/play/core/splitcompat/SplitCompat.html#installActivity(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Emulates installation of a split APK to allow immediate access to a given activity. |

| ### 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

### install

```
public static boolean install (Context context)
```

Emulates installation of split APKs to allow immediate access to their code and resources.

To use this method, you must invoke it at app startup with the app context (see[SplitCompatApplication](https://developer.android.com/reference/com/google/android/play/core/splitcompat/SplitCompatApplication.html)). If you call this method, you should also call[installActivity(Context)](https://developer.android.com/reference/com/google/android/play/core/splitcompat/SplitCompat.html#installActivity(android.content.Context))on any activities inside the dynamic feature module you've installed.

To learn more, read[Invoke SplitCompat at runtime](https://d.android.com/guide/playcore/dynamic-delivery#invoke_splitcompat_at_runtime). Additionally, to learn how to gain immediate access to language resources your app has downloaded, read[Access downloaded language resources](https://d.android.com/guide/playcore/dynamic-delivery#access_lang_resources).

<br />

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

|                                                                                      Returns                                                                                       ||
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | whether the split install was successful. This method returns`false`on platform versions lower than Android 5.0 (API level 21), which do not support split APKs. <br /> |

### installActivity

```
public static boolean installActivity (Context context)
```

Emulates installation of a split APK to allow immediate access to a given activity.

To use this API, use the following pattern:  

```
 protected void attachBaseContext(Context base) {
   super.attachBaseContext(base);
   SplitCompat.installActivity(this);
 }
 
```

To use this API, you also need to first call[install(Context)](https://developer.android.com/reference/com/google/android/play/core/splitcompat/SplitCompat.html#install(android.content.Context))with the application context at app startup.

<br />

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

|                                                                                    Returns                                                                                     ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | whether split install was successful. This method returns`false`on platform versions lower than Android 5.0 (API level 21), which do not support split APKs. <br /> |

|                                                                                 Throws                                                                                 ||
|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if SplitCompat was not called at startup on application context |