betomaluje / mi-band Goto Github PK
View Code? Open in Web Editor NEWMi Band integration
License: GNU General Public License v2.0
Mi Band integration
License: GNU General Public License v2.0
Is Mi Band 2 supported? I can work with MI Band 2?
Hello, I'm having a hard time, I have an android application made in Cordova and I need to integrate, can you help me?
Hi,
I've tried very simple application (single button -> on click vibrate) but unfortunatelly it does not work.
git: https://github.com/MrTheodor/MiWatch
Here is what I noticed on logcat:
10-07 21:16:16.269 11983-12273/pl.jkrajniak.miwatch W/BluetoothGatt﹕ Unhandled exception in callback
java.lang.IllegalArgumentException: Invalid parameters
at com.betomaluje.miband.model.UserInfo.create(UserInfo.java:74)
at com.betomaluje.miband.model.UserInfo.getSavedUser(UserInfo.java:277)
at com.betomaluje.miband.MiBand$1.onSuccess(MiBand.java:54)
at com.betomaluje.miband.bluetooth.BTConnectionManager$3.onServicesDiscovered(BTConnectionManager.java:319)
at android.bluetooth.BluetoothGatt$1.onSearchComplete(BluetoothGatt.java:305)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:217)
at android.os.Binder.execTransact(Binder.java:446)
did support for miband2
Good day, I am trying to sync data with the band after connection, and it stucks, callback do not return nothing. Other method, such as get battery info works normal. Thanks!
I'm testing the example app on Nexus 4 with Android 5.1.1. It manages to connect to my Mi Band (original version with color LEDs), blink with LEDs, vibrate, but fails to sync data.
Logcat:
I/BTConnectionManager( 3020): trying to connect
I/BTConnectionManager( 3020): connecting...
D/BluetoothGatt( 3020): connect() - device: 88:0F:10:92:xx:xx, auto: false
D/BluetoothGatt( 3020): registerApp()
D/BluetoothGatt( 3020): registerApp() - UUID=ba833154-5870-4379-8396-e55b971348fa
D/BtGatt.GattService(31894): registerClient() - UUID=ba833154-5870-4379-8396-e55b971348fa
D/BtGatt.GattService(31894): onClientRegistered() - UUID=ba833154-5870-4379-8396-e55b971348fa, clientIf=6
D/BluetoothGatt( 3020): onClientRegistered() - status=0 clientIf=6
D/BtGatt.GattService(31894): clientConnect() - address=88:0F:10:92:xx:xx, isDirect=true
D/btif_config(31894): btif_get_address_type: Device [88:0f:10:92:xx:xx] address type 0
D/btif_config(31894): btif_get_device_type: Device [88:0f:10:92:xx:xx] type 2
D/ACDB-LOADER( 189): ACDB -> send_afe_cal
W/bt-btif (31894): info:x0
D/ (31894): remote version info [88:0f:10:92:xx:xx]: 0, 0, 0
D/BtGatt.GattService(31894): onConnected() - clientIf=6, connId=6, address=88:0F:10:92:xx:xx
D/btif_config(31894): btif_get_device_type: Device [88:0f:10:92:xx:xx] type 2
D/BluetoothGatt( 3020): onClientConnectionState() - status=0 clientIf=6 device=88:0F:10:92:xx:xx
D/BluetoothGatt( 3020): discoverServices() - device: 88:0F:10:92:xx:xx
D/BtGatt.GattService(31894): discoverServices() - address=88:0F:10:92:xx:xx, connId=6
D/BtGatt.GattService(31894): onSearchCompleted() - connId=6, status=0
D/BluetoothGatt( 3020): onSearchComplete() = Device=88:0F:10:92:xx:xx Status=0
I/BTConnectionManager( 3020): Stopping discovery
E/miband-android( 3020): Fail: No bluetooth devices
E/MainNormalActivity( 3020): Fail: No bluetooth devices
D/MainNormalActivity( 3020): not found
D/miband-android( 3020): Connection success, now pair: true
D/MainNormalActivity( 3020): Connected with Mi Band!
I/ActivityManager( 552): START u0 {cmp=com.betomaluje.android.miband.example/.activities.ActivitiesChartActivity} from uid 10061 on display 0
V/WindowManager( 552): addAppToken: AppWindowToken{1fa1572f token=Token{51e310e ActivityRecord{2f86db09 u0 com.betomaluje.android.miband.example/.activities.ActivitiesChartActivity t442}}} to stack=1 task=442 at 2
D/ACDB-LOADER( 189): ACDB -> send_afe_cal
I/AppCompatViewInflater( 3020): app:theme is now deprecated. Please move to using android:theme instead.
V/WindowManager( 552): Adding window Window{25391ec5 u0 com.betomaluje.android.miband.example/com.betomaluje.android.miband.example.activities.ActivitiesChartActivity} at 6 of 12 (after Window{32bd9837 u0 com.betomaluje.android.miband.example/com.betomaluje.android.miband.example.activities.MainNormalActivity})
I/ActivityManager( 552): Displayed com.betomaluje.android.miband.example/.activities.ActivitiesChartActivity: +161ms
I/ActivityManager( 552): START u0 {cmp=com.betomaluje.android.miband.example/.activities.ActivitiesChartActivity} from uid 10061 on display 0
V/WindowManager( 552): addAppToken: AppWindowToken{32fef9be token=Token{89f9879 ActivityRecord{11d6e140 u0 com.betomaluje.android.miband.example/.activities.ActivitiesChartActivity t442}}} to stack=1 task=442 at 2
D/ACDB-LOADER( 189): ACDB -> send_afe_cal
I/AppCompatViewInflater( 3020): app:theme is now deprecated. Please move to using android:theme instead.
V/WindowManager( 552): Adding window Window{26e8d16c u0 com.betomaluje.android.miband.example/com.betomaluje.android.miband.example.activities.ActivitiesChartActivity} at 6 of 12 (after Window{32bd9837 u0 com.betomaluje.android.miband.example/com.betomaluje.android.miband.example.activities.MainNormalActivity})
I/ActivityManager( 552): Displayed com.betomaluje.android.miband.example/.activities.ActivitiesChartActivity: +133ms
D/BluetoothGatt( 3020): setCharacteristicNotification() - uuid: 0000ff03-0000-1000-8000-00805f9b34fb enable: true
D/BtGatt.GattService(31894): registerForNotification() - address=88:0F:10:92:xx:xx enable: true
D/BtGatt.GattService(31894): onRegisterForNotifications() - address=null, status=0, registered=1, charUuid=0000ff03-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 3020): setCharacteristicNotification() - uuid: 0000ff06-0000-1000-8000-00805f9b34fb enable: true
D/BtGatt.GattService(31894): registerForNotification() - address=88:0F:10:92:xx:xx enable: true
D/BtGatt.GattService(31894): onRegisterForNotifications() - address=null, status=0, registered=1, charUuid=0000ff06-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 3020): setCharacteristicNotification() - uuid: 0000ff07-0000-1000-8000-00805f9b34fb enable: true
D/BtGatt.GattService(31894): registerForNotification() - address=88:0F:10:92:xx:xx enable: true
D/BtGatt.GattService(31894): onRegisterForNotifications() - address=null, status=0, registered=1, charUuid=0000ff07-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 3020): setCharacteristicNotification() - uuid: 0000ff0c-0000-1000-8000-00805f9b34fb enable: true
D/BtGatt.GattService(31894): registerForNotification() - address=88:0F:10:92:xx:xx enable: true
D/BtGatt.GattService(31894): onRegisterForNotifications() - address=null, status=0, registered=1, charUuid=0000ff0c-0000-1000-8000-00805f9b34fb
D/BluetoothGatt( 3020): setCharacteristicNotification() - uuid: 0000ff0e-0000-1000-8000-00805f9b34fb enable: true
D/BtGatt.GattService(31894): registerForNotification() - address=88:0F:10:92:xx:xx enable: true
D/BtGatt.GattService(31894): onRegisterForNotifications() - address=null, status=0, registered=1, charUuid=0000ff0e-0000-1000-8000-00805f9b34fb
E/MainNormalActivity( 3020): Sync fail: data null
I/BTCommandManager( 3020): handleControlPoint GOT DATA:0x 6
I was able to establish a connection but I am unable to get any data or vibrate etc.
It always gives:
V/QueueConsumer: action WriteAction returned false
Hi @betomaluje,
First of all, thanks for this awesome Android library!
I'm thinking of integrating it with my RedAlert app, so that deaf people will know there is a rocket alert in their area (via vibration mostly).
I tried the MiBandExample
project, and it works pretty nicely (everything except for the vibration, which doesn't really do anything for some reason) -- is this something you are aware of?
My bet is that they changed something in the new firmware.
Thanks!
Does anyone know how can I implement custom vibration? There are some protocol changes there, but I can't find what they are.
I changed service from fee0 to 1802 and other vibrations are working now, but there is another problem with service and protocol with custom vibration.
Anyone know how to fix that?
Hi,
Thanks for the useful repo.
This is actually just a question. Can we get activity data and/or sleep data? If so, mind to share what are the example command sent to the activity control characteristic in term of bytes? is it something like this "\x01\x01\xE2\x07\x05\x03\x11\x2F\x00\x08"?
I believe this is the one called for activity notification but can anyone help me to understand the parsing?
I would appreciate if you can help. Thank you.
Hello first of all.
I got my Mi Band last week, sniffed the bluetooth traffic between the official app and the Mi Band a little bit, and my final search if there are already projects trying to build a better alternative app brought me here.
Your project looks very promising after my first look at the well structured code. I'll take a deeper look hopefully at this weekend.
However, what i've noticed so far: The official App not only differs between Light Sleep and Deep Sleep, but also between steps run and steps walked.
You currently have the two Sleep types implemented, but only one type for activity which i think contains up to three different kind of activity: Walked, Run and last but not least the normal accelerometer data.
Hi @betomaluje,
Any chance we can rename the resources used by the library?
Currently, @drawable/ic_launcher
and @string/app_name
are declared and this causes a conflict when importing the library via jCenter to an Android Studio-generated project.
While press sync option on both Activity usage & Service Usage btn getting error like this Sync error : OncharacteristicWrite fail
Is there a possibility this will support the heart rate monitor of the new Mi Band Pulse in the future?
Hi all
I'm trying out the example app, but I cannot get it to connect. The band is working fine with its official app, but, when I try this one, I get:
02-09 08:56:08.699 26181-26181/? I/BTConnectionManager: trying to connect
02-09 08:56:08.703 26181-26181/? I/BTConnectionManager: connecting...
02-09 08:56:08.706 26181-26181/? I/BTConnectionManager: not already paired
02-09 08:56:08.706 26181-26181/? D/BluetoothAdapter: stopLeScan()
02-09 08:56:08.706 26181-26181/? D/BluetoothAdapter: STATE_ON
02-09 08:56:08.707 26181-26181/? I/BTConnectionManager: Starting BTLE Discovery
02-09 08:56:08.709 26181-26181/? D/BluetoothAdapter: startLeScan(): null
02-09 08:56:08.710 26181-26181/? D/BluetoothAdapter: STATE_ON
02-09 08:56:08.712 26181-6142/? D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6
02-09 08:56:08.717 26181-26181/? V/BTConnectionManager: starting scan
02-09 08:56:53.730 26181-26181/? I/BTConnectionManager: Stopping discovery
02-09 08:56:53.732 26181-26181/? E/miband-android: Fail: No bluetooth devices
02-09 08:56:53.732 26181-26181/? E/MainNormalActivity: Fail: No bluetooth devices
02-09 08:56:53.732 26181-26181/? D/MainNormalActivity: not found
I'm having the same issue with the Activity
and the Service
. I'm working with Android 6. Band firmware is 1.0.9.55. Any help, please?
Hello everyone,
I would like to build an app for Mi Band 2, with notifications of the apps on the mi band screen, also with features presents in this lib. but I didn't found an api for that. How this lib works on Mi Band 2?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.