1 2Android BluetoothChat Sample 3=================================== 4 5This sample shows how to implement two-way text chat over Bluetooth between two Android devices, using 6all the fundamental Bluetooth API capabilities. 7 8Introduction 9------------ 10 11This sample should be run on two Android devices at the same time, to establish a two-way chat over 12Bluetooth between the devices. Select "Made discoverable" in overflow menu on one device and click 13on the Bluetooth icon on the other one, to find the device and establish the connection. 14 15The sample demonstrates the following, using the [Bluetooth API][1]: 16 171. [Setting up][2] Bluetooth 182. [Scanning][3] for other Bluetooth devices 193. [Querying][4] the local Bluetooth adapter for paired Bluetooth devices 204. [Establishing RFCOMM][5] channels/sockets 215. [Connecting][6] to a remote device 226. [Transfering][7] data over Bluetooth 23 24[1]: http://developer.android.com/guide/topics/connectivity/bluetooth.html 25[2]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#Permissions 26[3]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#FindingDevices 27[4]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#QueryingPairedDevices 28[5]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ConnectingDevices 29[6]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ConnectingAsAClient 30[7]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ManagingAConnection 31 32Pre-requisites 33-------------- 34 35- Android SDK 27 36- Android Build Tools v27.0.2 37- Android Support Repository 38 39Screenshots 40------------- 41 42<img src="screenshots/1-launch.png" height="400" alt="Screenshot"/> <img src="screenshots/2-devices.png" height="400" alt="Screenshot"/> <img src="screenshots/3-chat.png" height="400" alt="Screenshot"/> 43 44Getting Started 45--------------- 46 47This sample uses the Gradle build system. To build this project, use the 48"gradlew build" command or use "Import Project" in Android Studio. 49 50Support 51------- 52 53- Google+ Community: https://plus.google.com/communities/105153134372062985968 54- Stack Overflow: http://stackoverflow.com/questions/tagged/android 55 56If you've found an error in this sample, please file an issue: 57https://github.com/googlesamples/android-BluetoothChat 58 59Patches are encouraged, and may be submitted by forking this project and 60submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 61 62License 63------- 64 65Copyright 2017 The Android Open Source Project, Inc. 66 67Licensed to the Apache Software Foundation (ASF) under one or more contributor 68license agreements. See the NOTICE file distributed with this work for 69additional information regarding copyright ownership. The ASF licenses this 70file to you under the Apache License, Version 2.0 (the "License"); you may not 71use this file except in compliance with the License. You may obtain a copy of 72the License at 73 74http://www.apache.org/licenses/LICENSE-2.0 75 76Unless required by applicable law or agreed to in writing, software 77distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 78WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 79License for the specific language governing permissions and limitations under 80the License. 81