Page 88

Android Programming Cookbook

80 / 143

Chapter 5

Android Bluetooth Connection Example The Android platform includes support for the Bluetooth network stack, which allows a device to wirelessly exchange data with other Bluetooth devices. The Android Bluetooth APIs provide us access to the Bluetooth functionality in order to wirelessly connect to other Bluetooth devices, enabling point-to-point and multipoint wireless features. So, if we want to exchange data between different devices through our application, Bluetooth is a common way to connect two devices that support Bluetooth. In this example we are going to create an application which activates Bluetooth, finds Bluetooth devices that may be near, scans for other undiscovered Bluetooth devices and finally uses Bluetooth connection to create a Chat Application between two devices.

5.1

Introduction

For our example will use the following tools in a Windows 64-bit or an OS X platform: • JDK 1.8 • Android Studio 2.1.2 • Android SDK 6.0 For this example we have used methods and implementation from the Android Bluetooth Example related to Android Bluetooth searching and pairing devices. We have also made use of the Android RecyclerView Example for the ui and layout of our Bluetooth Chat. Let’s take a closer look:

5.2

Create a New Android Studio Project

Open Android Studio and choose Start a new Android Studio Project in the welcome screen.

SKY MAGZ  

This is Yahya Christian School Magazine

Read more
Read more
Similar to
Popular now
Just for you