I am trying out the github examples referenced in the Affectiva AI docs.
See: Affectiva Android example on github
The examples work, shipping with the following project gradle configuration:
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
defaultConfig {
minSdkVersion 21
targetSdkVersion 22
versionCode 1
setProperty("archivesBaseName", "$project.name-$versionName")
applicationId "com.affectiva.cameradetectordemo"
versionName "3.2.0-01"
}
buildTypes {
release {
minifyEnabled true
}
}
buildToolsVersion '27.0.3'
}
dependencies {
implementation('com.affectiva.android:affdexsdk:3.+')
}
The problem is, the examples work ONLY with compileSdkVersion and targetSdkVersion both set to 22. When i enter anything higher, 23 to 27, the apps compile but when i want to start the camera from inside the app, the app crashes with the Error Message
Questions:
Thanks for your help!
Android introduced the runtime permissions feature in API level 23. An app that targets 23+ must implement runtime permissions logic and request camera permission in order to access the camera.
The purpose of the sample you are referencing is to demonstrate use of the Affectiva SDK, so to avoid the need to add a bunch of runtime permission logic which would be irrelevant to that purpose, it targets API level 22.