简体   繁体   中英

Low Energy Bluetooth in Android using GATT

I've done a lot of reading about LE Bluetooth and GATT but I'm still struggling to fully understand what GATT is. To make it simple I'd like to express how I'd like my app to work, and simply be told if it's possible or not? The basic premise is it will be used as a location tracker and beacons (maybe iBeacons specifically) will be placed around the building and whenever you enter the range of the beacon a message will be sent to the server from the phone. The idea is that it doesn't need to scan, the phone just simply listens and whenever a beacon advertises, the phones in range will hear this and raise an event.

Scenario:

  • Client downloads the app and enters the building for the first time.
  • The building has a beacon in every room, advertising every 5 seconds for example.
  • When the client walks into a room and is in range of a beacon, the phone will get an unfriendlier version of the message "Beacon 2 has an RSSI of -87".
  • When they leave the room they will no longer hear the message and so will do nothing until it hears another message from a beacon.

NOTE: This scenario doesn't involve any scanning, looping or pairing. The phone will just know it has to listen for LE Bluetooth messages.

So, is this possible? From what I've seen it seems like you need to scan and connect with each beacon using GATT before you can receive data from them.

Any infomation of this matter is greatly appreciated, thankyou!

Yes, this is possible. Some high level scenario for a merchant store with beacon. 1) app client needs to have uuid or major id of beacons to be stored locally. 2) merchant store with same uuid or major id will broadcast messages. 3) phone OS keeps listening those messages when entered into geofence, OS will pass on these messages to the apps who are registered for beacons listening. 4) your app will match the uuid embed in the message and identify if its meant for it. 5) if message uuid does not match with uuid on client then app will not consume this message. 6) if message uuid matches then client will consume the message and display it on device, even your app is not running at that point of time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM