Cortex Library for Mobile
  • Getting Started
  • Objective-C API for iOS
    • CortexLib class
    • CortexClient class
    • CortexClientDelegate protocol
  • Java API for Android
    • EmotivLibraryLoader class
    • CortexLib class
    • CortexClient class
  • Additional JSON methods
    • loginWithAuthenticationCode
    • logout
    • queryVirtualHeadsets
    • createVirtualHeadset
    • deleteVirtualHeadset
    • updateVirtualHeadset
    • triggerVirtualHeadsetEvent
    • Virtual headset object
    • freeUpRecords
  • Release Notes
Powered by GitBook
On this page
  • The Cortex library and the Cortex JSON API
  • Supported Platforms
  • iOS
  • Android
  • Issue with the iOS keychain and the EMOTIV license system
  • Supported Headsets
  • The Cortex Library Examples

Getting Started

NextObjective-C API for iOS

Last updated 4 years ago

This documentation contains guidance for developing mobile applications with the EMOTIV Cortex library.

The Cortex library is only available upon request to the .

The Cortex library and the Cortex JSON API

The Cortex library uses the same JSON API as the Cortex service on desktop. This JSON API is documented in the .

On desktop, you send JSON messages to the Cortex service via a WebSocket connection. In the Cortex library, you also send JSON messages, but you use a native API (in or ) instead of a WebSocket connection. The Cortex library also provides some additional JSON methods that are not available when you connect to the Cortex API using a WebSocket.

So this documentation is divided in 3 parts:

  • the for iOS developers

  • the for Android developers

  • the for all developers

If you are not familiar with the Cortex JSON API, then please read the Cortex API documentation:

Supported Platforms

The EMOTIV Cortex library is available on iOS and Android.

iOS

On iOS, the library is provided as a XCFramework. It contains the binaries for iOS devices and the iOS simulator. It targets iOS 12. The library is currently in Beta.

The file Info.plist of your iOS application must contain the keys NSBluetoothAlwaysUsageDescription and NSBluetoothPeripheralUsageDescription.

Example:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>This application uses Bluetooth to find, connect and transfer data from EMOTIV headsets</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Connect EMOTIV headsets via Bluetooth</string>

Android

On Android, the library is build for armeabi-v7a and arm64-v8a. It supports Android 7.0 (API level 24) or above. The library is currently in Beta.

In order to use the Cortex library, the manifest file of your Android application must include these permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Your Android application must ask the user to grant these permissions:

  • Manifest.permission.ACCESS_COARSE_LOCATION

  • Manifest.permission.WRITE_EXTERNAL_STORAGE

Issue with the iOS keychain and the EMOTIV license system

Cortex library on iOS has a method to identify a iOS device, and store this information in the iOS keychain. This is to count how many iOS devices are using the same license.

If you use different vendor id in your iOS applications, then, when an end-user installs your applications on a single iOS device, the EMOTIV license system will believe that the license is used on 2 devices instead of 1. This will be a problem for the user, because they will be able to use their license on less devices that what they actually paid for.

For example, suppose you develop 2 iOS applications, and they use the bundle identifiers com.company.app1 and com.company123.app2. They also use same license "abcd". A user installs both of them on the same iOS device. The expectation is that only one iOS device is registered with the license "abcd". But actually 2 devices have been registered.

Supported Headsets

The Cortex library supports the following headsets:

Model

Firmware

Connection

All

BTLE 4.0

All

BTLE 4.0

Bluetooth® 5.0 will be available with upcoming software and firmware updates

All

BTLE 4.0

All

BTLE 4.0

All

BTLE 4.0

The Cortex library can connect to EMOTIV headsets via Bluetooth only. The EMOTIV USB dongle is not supported.

The Cortex Library Examples

To include the Cortex library XCFramework to your iOS application, please follow this from Apple.

To avoid this issue, EMOTIV recommends that you use the same for all your Cortex applications.

To help you getting started with your application, EMOTIV provides basic example applications for both iOS and Android. There are open source and hosted by Github at

guide
keychain access group
https://github.com/Emotiv/cortex-embedded-mobile-lib-example
EPOC+
EPOC X
EPOC Flex
Insight
MN8
EMOTIV customer service
Cortex API documentation
Objective-C
Java
Objective-C API
Java API
Additional JSON methods
https://emotiv.gitbook.io/cortex-api/emotiv.gitbook.io