All Projects → dkhmelenko → Miband Android

dkhmelenko / Miband Android

Licence: apache-2.0
Unofficial SDK for Xiaomi Mi Band

Programming Languages

kotlin
9241 projects

Labels

Projects that are alternatives of or similar to Miband Android

Dropbox Sdk Go Unofficial
⚠️ An UNOFFICIAL Dropbox v2 API SDK for Go
Stars: ✭ 148 (-8.64%)
Mutual labels:  sdk
Javascript Sdk
Javascript SDK to communicate with Binance Chain.
Stars: ✭ 151 (-6.79%)
Mutual labels:  sdk
Nacos Sdk Csharp
🌹 nacos csharp sdk
Stars: ✭ 157 (-3.09%)
Mutual labels:  sdk
Appsflyer React Native Plugin
AppsFlyer plugin for React Native
Stars: ✭ 149 (-8.02%)
Mutual labels:  sdk
Aliyun Ons
☁️ SDK of Node.js for Aliyun ONS. 🚀
Stars: ✭ 151 (-6.79%)
Mutual labels:  sdk
Aws Sdk Perl
A community AWS SDK for Perl Programmers
Stars: ✭ 153 (-5.56%)
Mutual labels:  sdk
Parse Sdk Android
The Android SDK for the Parse Platform
Stars: ✭ 1,806 (+1014.81%)
Mutual labels:  sdk
Contentful Management.js
JavaScript library for Contentful's Management API (node & browser)
Stars: ✭ 160 (-1.23%)
Mutual labels:  sdk
Openweatherplus Android
An open source weather APP for Android. 天气普拉斯Android版,自带天气数据的开源天气APP。
Stars: ✭ 153 (-5.56%)
Mutual labels:  sdk
Arcgis Pro Sdk
ArcGIS Pro SDK for Microsoft .NET is the new .NET SDK for the ArcGIS Pro Application.
Stars: ✭ 156 (-3.7%)
Mutual labels:  sdk
Jitsi Meet Sdk Samples
Jitsi Meet SDK examples (Android and iOS)
Stars: ✭ 150 (-7.41%)
Mutual labels:  sdk
Wechatpay Apache Httpclient
微信支付 APIv3 Apache HttpClient装饰器(decorator)
Stars: ✭ 147 (-9.26%)
Mutual labels:  sdk
Smartopencv
🔥 🔥 🔥 SmartOpenCV是一个OpenCV在Android端的增强库,解决了OpenCV Android SDK在图像预览方面存在的诸多问题,且无需修改OpenCV SDK源码,与OpenCV的SDK解耦
Stars: ✭ 1,869 (+1053.7%)
Mutual labels:  sdk
Dialogflow Ruby Client
Ruby SDK for Dialogflow
Stars: ✭ 148 (-8.64%)
Mutual labels:  sdk
P2p Cdn Sdk Javascript
Free p2p cdn github javascript sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 158 (-2.47%)
Mutual labels:  sdk
Kittik
Create slides in TypeScript and present them in the terminal using ASCII only!
Stars: ✭ 147 (-9.26%)
Mutual labels:  sdk
Pymedium
Unofficial Medium Python Flask API and SDK
Stars: ✭ 153 (-5.56%)
Mutual labels:  sdk
Card.io Android Sdk
card.io provides fast, easy credit card scanning in mobile apps
Stars: ✭ 1,942 (+1098.77%)
Mutual labels:  sdk
Onesignal Unity Sdk
OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Stars: ✭ 161 (-0.62%)
Mutual labels:  sdk
Esp8266 Firmware
DeviceHive esp8266 firmware. Control hardware via clouds with DeviceHive!
Stars: ✭ 154 (-4.94%)
Mutual labels:  sdk

Overview

GitHub Actions

This is unofficial SDK for Mi Band. This repository contains 2 modules:

  • miband-sdk-kotlin -- SDK for interraction with the MiBand
  • app -- Sample application demonstrating how to work with SDK.

The app was not tested with Mi Band 2 or newer bands. In case some of the method returns incorrect data or works wrong, pleare report an issue.

The idea came from this project. However, due to reactive vision of SDK it was reimplemented. Most of methods are implemented using RxJava library. Therefore the basic knowledge of reactive streams is required.

Contribution

In case you have ideas or found an issue, don't hesitate to create pull request or an issue.

How to use

IMPORTANT: Use this SDK on your own risk, developer of this SDK is NOT responsible for any unpredictable results.

Discovery

In order to start sending and receiving commands from the MiBand, you have to connect and pair with it. Available devices for connection can be found using startScan() method.

miBand.startScan().subscribe { result ->
                val device = result.device
                // save found device
            }

Scanning can be interrupted any time using the method stopScan().

Connection

Next action is to establish connection to the device (MiBand). The fuction connect(device) is responsible for that. The fuction returns Observable which emits a boolean value indicating if connection was established or not.

miBand.connect(device).subscribe { connected ->
                if (connected) {
                    // connection established
                } else {
                    // resolve connection issue
                }
            }

After successfully established connection device needs to be paired. The function pair() will do pairing to the connected device.

miBand.pair().subscribe { 
                // device is ready for communication
            }

Communication

When the band is connected and paired many different actions can be performed such as read battery information, start/stop vibration, read and change user information, read current steps in realtime, read heartrate and many other.

There are few examples how to perform those actions. Read battery information

miBand.batteryInfo.subscribe { batteryInfo ->
                ...
            }

Start vibration

miBand.startVibration(VibrationMode.VIBRATION_WITHOUT_LED).subscribe {
                ...
            }

Realtime steps notification

miBand.setRealtimeStepsNotifyListener(object: RealtimeStepsNotifyListener {
                override fun onNotify(steps: Int) {
                    ...
                }
            })
miBand.enableRealtimeStepsNotify().subscribe()

Reading heartrate can be done in a similar way: first setup the listener using setHeartRateScanListener() and then call the method startHeartRateScan().

All available methods for reading band information are available in class MiBand.kt. All methods have JavaDoc documentation explaining how the method works. They are:

  • startScan()
  • stopScan()
  • connect(device)
  • pair()
  • readRssi()
  • batteryInfo()
  • startVibration() / stopVibration()
  • enableRealtimeStepsNotify() / disableRealtimeStepsNotify()
  • setUserInfo(userInfo)
  • startHeartRateScan()
  • setLedColor()

License

Apache Licence 2.0

Copyright 2020 Dmytro Khmelenko

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].