> For the complete documentation index, see [llms.txt](https://emotiv.gitbook.io/cortex-library-for-mobile/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emotiv.gitbook.io/cortex-library-for-mobile/java-api.md).

# Java API for Android

On Android, the Cortex library provides an API written in Java. It contains three classes:

* [EmotivLibraryLoader](/cortex-library-for-mobile/java-api/emotivlibraryloader-class.md) to load the Cortex library
* [CortexLib](/cortex-library-for-mobile/java-api/cortexlib-class.md) to initialize the Cortex library
* [CortexClient](/cortex-library-for-mobile/java-api/cortexclient-class.md) to send and receive JSON messages to the Cortex library

## Workflow

On Android, the basic workflow of the API is as follow:

1. Create an object from the class [EmotivLibraryLoader](/cortex-library-for-mobile/java-api/emotivlibraryloader-class.md) and call its **load** method
2. Call the static method **start** of the class [CortexLib](/cortex-library-for-mobile/java-api/cortexlib-class.md)
3. Create an object from the class [CortexClient](/cortex-library-for-mobile/java-api/cortexclient-class.md)
4. Call the method **registerResponseHandler** of the [CortexClient](/cortex-library-for-mobile/java-api/cortexclient-class.md) object
5. Call the method **sendRequest** of the [CortexClient](/cortex-library-for-mobile/java-api/cortexclient-class.md) object to send JSON messages to the Cortex library. You can call this methods as many times as necessary. Cortex will respond asynchronously, using the handler you provided at step 4. Please check the [Cortex API documentation](https://emotiv.gitbook.io/cortex-api/) to know the format of the JSON messages.
6. Call the static method **stop** of the class [CortexLib](/cortex-library-for-mobile/java-api/cortexlib-class.md)
