1 2Android BluetoothAdvertisements Sample 3=================================== 4 5Sample demonstrating how to advertise small amounts of data using the Bluetooth 6Low Energy API. Also demonstrates how to scan for those Advertisements. (requires 72 devices to see full operation) 8 9Introduction 10------------ 11 12This sample demonstrates use of the Bluetooth Low Energy (BLE) [Advertisement][1] and [Scanning][2] APIs. 13The functionality is split into two fragments - one for Advertising, one for Scanning. 14 15ScannerFragment activates BLE Scanning for 5 seconds and displays a list of found devices which are advertising 16using this sample. It shows the device type, Bluetooth address, and when it was last seen. User can 17refresh to scan again and update the list. 18 19AdvertiserFragment allows the user to toggle BLE Advertising of that device. It broadcasts basic 20information about the device along with a UUID specific to this app so the ScannerFragment on other 21devices can filter by it. 22 23Note: A device cannot detect its own BLE advertisements. You will need two devices to see this 24sample in action. 25 26[1]:https://developer.android.com/reference/android/bluetooth/le/BluetoothLeAdvertiser.html 27[2]:https://developer.android.com/reference/android/bluetooth/le/BluetoothLeScanner.html 28 29Pre-requisites 30-------------- 31 32- Android SDK 27 33- Android Build Tools v27.0.2 34- Android Support Repository 35 36Screenshots 37------------- 38 39<img src="screenshots/1-main.png" height="400" alt="Screenshot"/> 40 41Getting Started 42--------------- 43 44This sample uses the Gradle build system. To build this project, use the 45"gradlew build" command or use "Import Project" in Android Studio. 46 47Support 48------- 49 50- Google+ Community: https://plus.google.com/communities/105153134372062985968 51- Stack Overflow: http://stackoverflow.com/questions/tagged/android 52 53If you've found an error in this sample, please file an issue: 54https://github.com/googlesamples/android-BluetoothAdvertisements 55 56Patches are encouraged, and may be submitted by forking this project and 57submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 58 59License 60------- 61 62Copyright 2017 The Android Open Source Project, Inc. 63 64Licensed to the Apache Software Foundation (ASF) under one or more contributor 65license agreements. See the NOTICE file distributed with this work for 66additional information regarding copyright ownership. The ASF licenses this 67file to you under the Apache License, Version 2.0 (the "License"); you may not 68use this file except in compliance with the License. You may obtain a copy of 69the License at 70 71http://www.apache.org/licenses/LICENSE-2.0 72 73Unless required by applicable law or agreed to in writing, software 74distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 75WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 76License for the specific language governing permissions and limitations under 77the License. 78