简体   繁体   中英

Bluetooth LE send string data between Android devices via application

I'm completely clueless on how to use BLE. I need to create an application for Android devices that sends a small string from one Android device to the other. I am NOT using any sensor type devices. I only need to send a string from one phone to another phone using a BLE connection. From what I understand, I need to create a custom service and implement a GATT server on a central device and have a peripheral device access it as a client but I'm not even sure if that's what I need for my situation. I have scoured the internet and nothing I have found deals with this topic specifically. I have no idea how to create a GATT server for this purpose and what I need to include in order to create a service. Can someone please explain to me what I need to do or point me towards some resources that are useful for A COMPLETE NOVICE? Thanks.

You are right so far. You need to create two applications on two different Android devices as follows:-

  • Android App A on Device #1: An app to act as a GATT Server to host your data that you want to send. For that, you will need GATT Server API .
  • Android App B on Device #2: An app to act as a GATT Client to connect to Device #1 and read the string data from the GATT Server using GATT Client API .

BLE is a relatively complex technology but luckily there are so many resources to help you get started. I recommend that you first understand how BLE technology works and for that I the following links are useful:-

Once you have a better understanding of the protocol, the following links are useful for understanding Android BLE development (in addition to the video posted in the comment):-

However, before going through any of these, it's always a good idea to get a feel and practical understanding of how the technology works. For that I recommend using the nRF Connect Android app to connect and read data off devices. This way, you'll be able to relate to the new information and hopefully understand the new concepts easier.

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