BrainBit for developers Subscribe for updates Visit website

Android

Samples for BrainBit - link

Latest version: `1.0.6.18`

The Android version is designed for APIs >= 21.

Neurosdk for android is distributed using JitPack as an aar library. Here is an example of adding SDK to an AndroidStudio project using gradle:

Add to `settings.gradle` of project:

dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
            
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        ...
        maven { setUrl("https://jitpack.io") }
    }
}
            

            

            

            

            

            

            

            

            

 and to `build.gradle` of app:

dependencies {
    implementation 'com.github.BrainbitLLC:neurosdk2:1.0.6.18'
}
            
dependencies {
    implementation("com.github.BrainbitLLC:neurosdk2:1.0.6.18")
}
            

            

            

            

            

            

            

            

            

 

SDK uses a runtime permission to Bluetooth and Location, so you need to ask user about it. For this action SDK contains helper classes:

import com.neurosdk2.helpers.PermissionHelper;
import com.neurosdk2.helpers.interfaces.IPermissionListener;
...
if(!PermissionHelper.HasAllPermissions(ctx)){
    PermissionHelper.RequestPermissions(ctx, (grantedPermissions, deniedPermissions, deniedPermanentlyPermissions) -> {
        ...                  
    }); 
}
            
if(!PermissionHelper.HasAllPermissions(requireContext())){
                PermissionHelper.RequestPermissions(requireContext()
                ) { grantedPermissions, deniedPermissions, deniedPermanentlyPermissions -> ... }
            }