Hardware Reference
In-Depth Information
As shown in Figure 8-4 (which shows the project directory structure on the left and the
main code window in the right), an Android project contains many folders and files,
but you'll be working in only a few. The main sourcecode file is located in the /src
directory.
Figure 8-4. The main Java window in Eclipse
Each project also includes a manifest, called AndroidManifest.xml , that details essential
information about the application to the Android system. Android requires this infor‐
mation before it can run any code on the system. Beyond that, you'll also be working
in the /res folder , which contains XML files that handle the layout and menus that you
will be using.
Android programming is a huge topic in itself, far beyond the scope
of this chapter, which focuses only on the context of integrating Blue‐
tooth Low Energy into an Android app. For more complex GUI ap‐
plications, we recommend consulting other Android programming
texts.
Before you begin any actual coding, you'll need to enable BLUETOOTH and BLUETOOTH_AD
MIN permissions inside the Android manifest. Double-click the AndroidManifest.xml
file and select the Permissions tab (shown in Figure 8-5 ). Choose “Add…”→“Uses Per‐
mission” and type android.permission.BLUETOOTH in the Name field. Do the same to
add another “Uses Permission,” this time giving it the name android.permission.BLUE
 
Search WWH ::




Custom Search