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