9 Native hardware

 

This chapter covers

  • How to load and save app data to a file
  • How to use the device’s camera to take and save pictures
  • How to use GPS and WiFi signals to determine your location

In the first eight chapters of the book, you learned the basics of NativeScript: how it works, how apps are organized, how to create pages, how to add various UI elements to these pages, and how to manage data-entry using data binding. Through these topics, we laid the foundation of your NativeScript knowledge. In fact, you’ll use that knowledge in every app you build. Even though these topics are foundation, they’ve focused on showing information on the screen of a mobile device, while leaving out an important aspect of mobile app development: interacting with native mobile device hardware.

9.1   The file system module

9.1.1   Using the file system module

9.1.2   Integrating the file system module into the Pet Scrapbook

9.2   Camera

9.2.1   Taking photos

9.2.2   Saving the image to the file system

9.2.3   Displaying the image

9.3   Using GPS and location services

9.3.1   Plugins

9.3.2   Using the geolocation plugin

9.4   Summary

9.5   Exercise

9.6   Solutions