Leia Core Native SDK (CNSDK) Android Java Documentation

CNSDK simplifies Leia Lightfield device support implementation. It provides a simple API to setup and use all necessary components.

While not absolutely required, the CNSDK will allow you to harness the ability of your lightfield device in a simple manner. Any developer attempting to create Leia lightfield 3D experiences without CNSDK will encounter significant technical challenges. We therefore highly suggest using CNSDK for your application.

Let’s start from a quick example.

Initialize CNSDK
class MainApp : Application() {
    override fun onCreate() {
        // ...

        val initArgs = LeiaSDK.InitArgs()
        initArgs.platform.app = this
        LeiaSDK.createSDK(initArgs)
    }
}
Add InterlacedSurfaceView to a layout
<androidx.constraintlayout.widget.ConstraintLayout
    ...>
    <com.leia.sdk.views.InterlacedSurfaceView
        android:id="@+id/interlacedView"
        ... />
</androidx.constraintlayout.widget.ConstraintLayout>
Set InterlacedSurfaceView content
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        // ...

        val bitmap = ... // Load Bitmap
        val asset = InputViewsAsset.createSurfaceFromLoadedBitmap(bitmap, true)

        val interlacedView = findViewById(R.id.interlacedView)
        interlacedView.setViewAsset(asset)
    }
}
Enable the Backlight
class MainActivity : AppCompatActivity() {
    override fun onWindowFocusChanged(hasFocus: Boolean) {
        // ...

        LeiaSDK.getInstance()?.let {
            it.enableBacklight(hasFocus)
            it.startFaceTracking(hasFocus)
        }
    }
}

And that’s it.

For more, see samples provided with CNSDK. Also, make sure to read documentation of the main classes: LeiaSDK, InterlacedSurfaceView, InputViewsAsset.

ProGuard (Obfuscation)

CNSDK contains native components that are calling into Java components using Java Native Interface. Because of that ProGuard obfuscation/optimization should not be applied to CNSDK Java bytecode. The following ProGuard rules can be used to achieve this:

-keep class com.leia.sdk.** { *; }
-keep class com.leia.core.** { *; }
-keep class com.leia.internal.** { *; }
-keep class com.leia.headtracking.** { *; }

It’s better to use the provided rules instead of using -keep class com.leia.** { *; } because it will disable optimization for other Leia libraries which in the general case is undesirable.

Packages 
Package Description
com.leia.core  
com.leia.headtracking  
com.leia.headtrackingservice  
com.leia.sdk
See the main user-facing class - LeiaSDK
com.leia.sdk.graphics  
com.leia.sdk.internal  
com.leia.sdk.video  
com.leia.sdk.views