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