• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2014 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17
18<sample>
19    <name>BluetoothChat</name>
20    <group>Connectivity</group>
21    <package>com.example.android.bluetoothchat</package>
22
23    <!-- change minSdk if needed-->
24    <minSdk>14</minSdk>
25
26    <!-- Include additional dependencies here.-->
27    <!-- dependency>com.google.android.gms:play-services:5.0.+</dependency -->
28
29    <strings>
30        <intro>
31            <![CDATA[
32            This application allows two Android devices to carry out two-way text chat over
33            Bluetooth. It demonstrates all the fundamental Bluetooth API capabilites, such as:
34              (1) Scanning for other Bluetooth devices
35              (2) Querying the local Bluetooth adapter for paired Bluetooth devices
36              (3) Establishing RFCOMM channels/sockets
37              (4) Connecting to a remote device
38              (5) Transfering data over Bluetooth
39            ]]>
40        </intro>
41    </strings>
42
43    <!-- The basic templates have already been enabled. Uncomment more as desired. -->
44    <template src="base" />
45    <template src="FragmentView" />
46
47    <!-- Include common code modules by uncommenting them below. -->
48    <common src="logger" />
49    <common src="activities"/>
50
51    <metadata>
52        <status>PUBLISHED</status>
53        <categories>Connectivity</categories>
54        <technologies>Android</technologies>
55        <languages>Java</languages>
56        <solutions>Mobile</solutions>
57        <level>ADVANCED</level>
58        <icon>screenshots/icon-web.png</icon>
59        <screenshots>
60            <img>screenshots/1-launch.png</img>
61            <img>screenshots/2-devices.png</img>
62            <img>screenshots/3-chat.png</img>
63        </screenshots>
64        <api_refs>
65            <android>android.bluetooth.BluetoothAdapter</android>
66            <android>android.bluetooth.BluetoothDevice</android>
67            <android>android.bluetooth.BluetoothServerSocket</android>
68            <android>android.bluetooth.BluetoothSocket</android>
69        </api_refs>
70
71        <description>
72<![CDATA[
73This sample shows how to implement two-way text chat over Bluetooth between two Android devices, using
74all the fundamental Bluetooth API capabilities.
75]]>
76        </description>
77
78        <intro>
79<![CDATA[
80This sample should be run on two Android devices at the same time, to establish a two-way chat over
81Bluetooth between the devices. Select "Made discoverable" in overflow menu on one device and click
82on the Bluetooth icon on the other one, to find the device and establish the connection.
83
84The sample demonstrates the following, using the [Bluetooth API][1]:
85
861. [Setting up][2] Bluetooth
872. [Scanning][3] for other Bluetooth devices
883. [Querying][4] the local Bluetooth adapter for paired Bluetooth devices
894. [Establishing RFCOMM][5] channels/sockets
905. [Connecting][6] to a remote device
916. [Transfering][7] data over Bluetooth
92
93[1]: http://developer.android.com/guide/topics/connectivity/bluetooth.html
94[2]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#Permissions
95[3]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#FindingDevices
96[4]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#QueryingPairedDevices
97[5]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ConnectingDevices
98[6]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ConnectingAsAClient
99[7]: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ManagingAConnection
100]]>
101        </intro>
102    </metadata>
103
104
105</sample>
106