Chapter 9: BlueChat: A Bluetooth Chat Client

In This Chapter

• Setting up and using simple Bluetooth connections

• Using procedures with parameters

• Updating and controlling text in dynamic labels

BlueChat is a simple chat client/server. With it, two previously paired devices can send text messages to each other. As with the previous project, this project builds a base level of functionality and then challenges you to create added functionality. BlueChat can set up the client/server connection between only two devices — adding a third device is a whole different level of complexity.

The Bluetooth component in App Inventor is a low-level component. This means that it has a great deal of power and functionality, but also a great deal of complexity. Two Bluetooth components can be placed from the Not Ready for Prime Time palette. One is the Bluetooth server, the other the Bluetooth client. Only one of each is needed for two-way connectivity between your devices. However, in the BlueChat application, you use both components so that either device can initiate the connection.

Creating the BlueChat Application

While creating the BlueChat application, you will learn the basics of establishing a connection between two Bluetooth devices and then passing a basic text string between them. Many complexities are involved in Bluetooth communications. The functionality included with the App Inventor components can handle most common scenarios. However, in this project, you strip Bluetooth communication ...

Get App Inventor for Android: Build Your Own Apps — No Experience Required! now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.