Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 556 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
556
Dung lượng
14,81 MB
Nội dung
[...]... Foreground Dispatching Foreground NDEF Push Reacting to an NDEF Tag NdefMessage and NdefRecord Parsing and Reading NDEF Tags Getting Ready to Write to a Tag Writing to the Tag Putting it All Together Future Considerations NFC N-Mark Peer-to-Peer NFC Sharing Peer-to-Peer Android APIs Go Forth and NFC! Summary CHAPTER 12: USING THE CAMERA Using the Camera Activity Controlling the Camera with Your Own Activity... Sensing capabilities are derived from the available hardware on Android devices and from creative use of it A capability may use values directly from hardware that can measure physical quantities, such as the magnetic field sensor It may use hardware that the user typically interacts with, such as the camera and microphone A capability may even use a combination of hardware and server-based processing,... process each kind of data and go beyond explaining simple uses of the APIs Beyond sensor programming, this book describes techniques that are applicable in any app For example, the chapters in this book show you how to use BroadcastReceivers, Services, AsyncTasks, and databases for various tasks START SENSING! Apps can utilize sensors to create amazing features that are unique and save a user’s time Android s... “playgrounds” which allow you to observe the relevant APIs working under various parameter settings Download the app from Google Play here: https://play.google.com/store/apps/ details?id=root.gast.playground GREAT ANDROID SENSING TOOLKIT (GAST) The code in this book is part of an open source project called Great Android Sensing Toolkit (GAST) The latest updates and code are available on Github at the... selecting which sensors to use in an app, and implementing an app that can acquire sensor data and interpret it Android s Sensing Capabilities An Android device can have a wide variety of sensors This book uses a defi nition of sensor that incorporates many of an Android device’s capabilities In this book asensor is: A capability that can capture measurements about the device and its external environment... expect apps to use any existing and new sensors when possible Therefore, using Android s sensors is a crucial skill for any Android programmer to master This book gives you the knowledge and code you need to develop this skill and make great apps that use sensors PROGRAMMING WITH ANDROID SENSORS Writing apps that use Android s sensors involves understanding the sensing capabilities of an Android device,... location sensors work, as described in Chapter 1, may lead you expect poor accuracy while a device is indoors ‰ Physical sensors: Knowing information about what the physical sensors measure, as discussed in Chapter 5, can help you understand what inferences an app can reasonably make with the sensor output Using API Boilerplate In any app, acquiring sensor data requires similar code Each kind of data... Rotation Vector Implementation Details Processing Gravity Sensor Data Processing Accelerometer and Magnetic Field Data Processing Rotation Vector Data Notifying the User of Orientation Changes NorthFinder Summary CHAPTER 8: DETECTING MOVEMENT Acceleration Data Accelerometer Data Linear Acceleration Sensor Data Data While Device Is in Motion Total Acceleration Implementation DetermineMovementActivity AccelerationEventListener... constraints, and using the Camera and View objects properly Chapters 12 and 13 describe abstract classes that handle these details ‰ NFC: Using NFC involves understanding the various steps needed to read and write NFC tags and what data to put in them Chapter 11 explains a complete code example that is easy to adapt Collecting Sensor Data Once an app can initialize and acquire sensor data, it then needs... temperature sensor ‰ Chapter 11: Using NFC tags with custom data to track inventory ‰ Chapter 13: Using the camera to detect the Android logo ‰ Chapter 14: Using the microphone to implement a clapper by detecting loud noises and a singing tone ‰ Chapters 17 and 18: Using speech recognition and Text-to-Speech to implement voice commands that query and manipulate data in a food database ADVANCED ANDROIDPROGRAMMING . EDITOR Kimberly A. Cofer EDITORIAL MANAGER Mary Beth Wakefi eld FREELANCER EDITORIAL MANAGER Rosemarie Graham ASSOCIATE DIRECTOR OF MARKETING David Mayhew MARKETING MANAGER Ashley Zurcher BUSINESS MANAGER Amy. to Chapters 7 and 10. JON WEBB, the developer of Jon’s Java Imaging Library, has been developing software professionally for over three decades. He enjoys programming image processing on Android. <Chapter No> V1 - MM/DD/2010 xvi CONTENTS onProviderDisabled () and onProviderEnabled () 19 onStatusChanged () 20 Obtaining a Handle to LocationManager 20 Requesting Location Updates 23 Cleaning