Including PacktHAL within your apps
Before diving into using PacktHAL to interface with GPIOs, you must understand how to include PacktHAL support in your apps. We will walk you through the process of adding the PacktHAL code into your app and then building it. PacktHAL will be packaged with your app in the.apk
app as a shared library. The source code for the library exists within the app's project directory, but it is built separately from the Java code of the app. You must manually build the PacktHAL shared library before your app can include it within the .apk
app and use it.
Note
We include a prebuilt version of the PacktHAL library in each of the example app projects included with this book, so you can jump into building and running the example apps right away without worrying about the details of building PacktHAL. Once you begin creating your own custom apps and modifying PacktHAL for your own hardware projects, you will need to understand how to build PacktHAL from source.