betomaluje/Mi-Band

Invalid parameters UserInfo.create(UserInfo.java:74)

Closed this issue · 4 comments

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)

Hi Jakub

first of all I'm really really sorry for this late response. I've been really
busy with my new job.

Also I've updated the code to fix some minor bugs:
https://github.com/betomaluje/Mi-Band

Easy use: compile 'com.betomaluje.miband:app:1.0.3'

I'm really grateful you're using this library.

Have a great day!

Cheers!

Sent with inky
"Jakub Krajniak" notifications@github.com wrote:

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)

Reply to this email directly or [view it on
GitHub](https://github.com/betomaluje/Mi-
Band/issues/3).

I'm getting the same exception on version 1.0.3

Thanks for update!

I think that the problem comes from line UserInfo.java:74; First I thought that those data like weight or age comes from MiBand :-D but then I realized that it comes from SharedPreferences where there has to be set beforhand. It is a variety of application where you actually do not need to store any user profile apart from btAddress.
My quick solution was to change this line to

if (address == null || address.length() == 0) {

btw, would it be possible to change name of module from app to libsomething, otherwise it is difficult to import it as a module in AS.

Changed validation as @MrTheodor suggested.

Regarding changing the module's name, just create a new issue and I will get to it asap