Time for action – decoding camera feed from native code

  1. Create a new hybrid Java/C++ project like shown in Chapter 2, Creating, Compiling, and Deploying Native Projects:
    • Name it LiveCamera.
    • Its main package is com.packtpub.
    • Its main activity is LiveCameraActivity.
    • Get rid of res/main.xml as we will not create a GUI this time.
    • Do not forget to create a jni directory at project's root.
  2. In the application manifest, set the activity style to fullscreen and its orientation to landscape. Landscape orientation avoids most camera orientation problems that can be met on Android devices. Also request acces permission to the Android camera:
    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.packtpub" ...

Get Android NDK Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.