Chapter 5. Communicating with the Outside World

In this chapter, we will cover the following recipes:

  • Consuming REST services with HttpClient
  • Obtaining a network state
  • Handling network state changes
  • Using the DownloadManager element
  • Accessing Bluetooth
  • Transferring data via Bluetooth
  • Receiving NFC events
  • Writing NFC tags
  • Transferring data via NFC
  • Obtaining location coordinates and addresses

Introduction

Communication is one of the most important aspects of human existence. Everyone communicates with someone else at some point in their lives.

We as humans speak, write, draw, and move to send a message or convey some sort of message to someone else. Babies cry, children speak, and adults write to let someone else know what they are doing or what they want the other person to do.

Communication can be an instruction to do something, or it can be an expression of feelings. Communication can also be a means of sharing data or information.

Mobile apps are very similar to humans when it comes to communication, not because apps inherently want to share, but rather as a result of having a user. Users of the app want to share or communicate, and thus the app is designed to share or communicate.

Not only do users want to share data they have communicated with the rest of the world, such as through social media, they may also want to share data with a specific device. These devices may belong to another person or to the user themselves.

Information can be shared over the Internet using Wi-Fi or mobile data, and sharing is really only limited by the user's imagination. There are also various short range communication technologies in the world.

Bluetooth and Near Field Communications (NFC) are very common, whether to play sound over wireless speakers, or to identify an object. These forms of communication are often designed for one-on-one interactions, thus making them more personalized means of communication.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.191.169