kavie
kavie

Reputation: 2244

Connect to BLE health devices through android background service

I'm creating an app to connect A&D BLE BP, weight devices, please let me know that the following queries are possible or not.

1.Connect to BLE health devices using android background service. is there an efficient way to connect and collect data reading from ihealth devices?

(or)

2.Click on Button to start scanning, find and connect devices, then collect values from connected devices?

Upvotes: 0

Views: 2210

Answers (1)

Quang Nguyen
Quang Nguyen

Reputation: 2660

For your app, it requires several steps. The implementation depends on your device and app function. Generally, it will involves the following steps.

  1. Scan: It is already on the background thread when you use Android BLE API. You can display a list of discovered devices
  2. Connect: It will run on background too, Android Framework will give you a callback to notify its connection status.
  3. Read data: This step requires your own implementation. if you read data once, it is simple. If you update periodically, you need a background Service or a Thread(to run background) + Handler(to update UI).

A good starting point is Google BLE guideline: https://developer.android.com/guide/topics/connectivity/bluetooth-le.html
It is little complex when directly using Android Framework, you can try third-party libs instead. For example, https://github.com/RobotPajamas/Blueteeth.

Upvotes: 1

Related Questions