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