Download the SAFR Embedded SDK package for Android from the Developers tab of the SAFR Download Portal. The eSDK is distributed as a set of (native code) shared objects (.so
) and resource files. Make sure that you have the Android development tools and the Android NDK version 20b or newer installed on the computer on which you intend to build your application.
Copy the library and model files from the SAFR eSDK into the directory containing your final application. Place the shared object files inside a directory named lib
and the resource files inside a directory named model
. Assuming that your application would be called Unique
and that you ship it inside a directory called UniqueApp
then the structure of your final application directory would look like this:
Copy the library and model files from the SAFR eSDK into the directory containing your final application. Place the shared object files inside a directory named lib
and the resource files inside a directory named model
. Assuming that your application would be called Example
and that you ship it inside a directory called ExampleApp
then the structure of your final application directory would look like this:
ExampleApp/
Example
lib/
...
model/
...
Note: The application has to be built as a 64-bit application. 32-bit applications are not supported.
SDK comes with 2 sample applications: panoptes and facefind. These are console applications demonstrating how to use the eSDK's C API. To build them, you need to do the following:
The sample apps can only be built on Linux and macOS machines. The panoptes/bin folder needs to be copied to the target platform and then the panoptes executable run from the device shell. The folder needs to have executable permission.
You can develop Android mobile apps with Android Studio and use the eSDK from Java (or Kotlin) code by using Java Native Interface (JNI). JNI is basically a bridge between a byte code that runs in the Java Virtual Machine and the native code.
To start, we've prepared a sample native Java/C++ Android project called FaceCompare. The project consists of:
Note: When building a release version of the application, any new JNI method declarations or classes used in those methods should be added to Proguard rules. These are accessed via reflection from the native code so their signatures must remain unchanged, rather than being obfuscated.