Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 28 2019 15:36

    dariuszseweryn on dagger

    Improved DeviceComponent and De… (compare)

  • Jan 28 2019 15:21

    dariuszseweryn on dagger

    Improved ClientComponent and Cl… Improved DeviceComponent and De… (compare)

  • Jan 28 2019 15:10

    dariuszseweryn on dagger

    Merged DeviceModuleBinder with … (compare)

  • Jan 28 2019 15:09

    dariuszseweryn on dagger

    Merged ClientModuleBinder with … (compare)

  • Jan 24 2019 15:01
    Steppschuh closed #536
  • Jan 23 2019 19:14
    dariuszseweryn edited #534
  • Jan 22 2019 11:55
    Steppschuh opened #536
  • Jan 20 2019 22:46
    lukaszkalnik opened #535
  • Jan 20 2019 19:53
    mohank1288 opened #534
  • Jan 20 2019 13:14
    lukaszkalnik edited #528
  • Jan 19 2019 22:33
    lukaszkalnik edited #528
  • Jan 19 2019 22:32
    lukaszkalnik edited #528
  • Jan 19 2019 22:32
    lukaszkalnik synchronize #528
  • Jan 19 2019 15:39
    lukaszkalnik closed #531
  • Jan 19 2019 15:39
    lukaszkalnik synchronize #528
  • Jan 18 2019 17:27

    dariuszseweryn on dagger

    Improved DeviceComponent and De… (compare)

  • Jan 18 2019 17:22

    dariuszseweryn on dagger

    Improved ClientComponent and Cl… (compare)

  • Jan 18 2019 17:21

    dariuszseweryn on dagger

    Bumped dagger version to 2.21 (compare)

  • Jan 18 2019 16:23
    dariuszseweryn closed #510
  • Jan 18 2019 16:21

    dariuszseweryn on master

    Added sample application in kot… (compare)

Mike Simone
@simonemike95
Is there an easy way to clear the device cache? Looked at a few topics on SO but nothing has worked for me thus far. My BLE device will reset itself when some settings are changed in the app, I dispose all disposables, but it seems that upon attempting to reconnect, the app is using a cached version of the device sometimes? Not quite sure where I'm going wrong with things.
To be clear - sometimes the disconnect and connect will happen properly, other times the app connects, and the device immediately disconnects, but GATT seems to think it is still connected somehow. Connection state observing works flawlessly on initial connection, only seeing issues after the device is resetting.
Dariusz Seweryn
@dariuszseweryn
If you think about BluetoothGatt.refresh() then check wiki for custom operations. Other than that I do not know how to interpret your case
Mike Simone
@simonemike95
How would I pass in the BluetoothGatt object? From what I understand, it's not directly accessible using the library
Dariusz Seweryn
@dariuszseweryn
I encourage you to check wiki I mentioned
Alex Vo
@vtatntpt_twitter
How to retry connecting with n times? With n = 3. Thanks
Alex Vo
@vtatntpt_twitter
Dariusz Seweryn
@dariuszseweryn
You're welcome! :D
Alex Vo
@vtatntpt_twitter
I have problem, this error: "with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)" always happens with some phone models use Android 10 but others normal. Is there any way to fix it? Thanks.
7 replies
Joshua
@joshdaquino
Has anyone used RxAndroidBle to connect to multiple devices at the same time?
5 replies
Hasan Abdullah
@hasancse91
Hello guys! I've a question.
Is this library work properly in an Android phone without play service? e.g: some Huawei device (without play service)
1 reply
Gilad Raz
@seotrader
Hello guys, is this library good for scanning on the background BLE devices near me while spending only a little of the battery? what is the best practice to achieve that with the library?
3 replies
jeevankibbcom
@jeevankibbcom
Hi, how to unsubscribe from a notification without closing the connection to BLE, I see in some posts they are disposing the connection to unsubscribe I don't want that for me BLE connection should be there I just want to unsubscribe from some notifications on I am using replayshare and compositdisposable. Is this possible, if yes can you guide me how???
7 replies
Tran Van Luat
@luattv_gitlab
hi there,
I have the same problem with @AlexVo above, that i meet the problem
"with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)"
With device AQOUS R5G.
Because the problem is under investigating, so I decided to make an exception for app when release,
And so, I want to know how it is on other device.
Does any-one here have the same problem? if yes plz share the device name with me?
Thank you very much!
Roman Myronov
@post_mortem_gitlab
Same problem for Galaxy S10+
Teodora Georgescu
@mynameisteodora
Hi everyone, I have a question similar to @jeevankibbcom. I need to subscribe separately to two characteristics A and B. When I listen to notifications for characteristic A, characteristic B stops sending data. The same is true for characteristic B, this is just the way our device is supposed to work. I need to therefore be able to enable/disable characteristic notifications, say on the press of a button by the user. I have tried this https://stackoverflow.com/questions/40485301/how-to-disable-a-notification-with-rxandroidble/40486471#40486471 but it didn't work for me, I am using Kotlin and the connection never reaches the subscribe block. Is there a more up to date version of doing this?
2 replies
also when i disable a notification i do not want my connection to be torn down, and that's what happens if I do subscription.dispose(). I need the connection to stay in place so that I can re-enable the notifications on either characteristic
Teodora Georgescu
@mynameisteodora

So I did manage to have a sometimes working solution of a subscription to two different characteristics. To give the context for my application:

  • I have a peripheral that advertises on two characteristics, A and B
  • When I am listening for A, B does not emit anything
  • When I am listening for B, A does not emit anything
  • So A and B will never advertise at the same time
    This is because we want to optimise power consumption.

I need to be able to trigger one characteristic on and the other off and I am doing so via an Observable<Boolean>, as suggested in the stackoverflow post.

  • I have an Observable<Boolean> for A which emits true when my app should listen to A
  • and an Observable<Boolean> for B which emits true when my app should listen to B

I also have two buttons in my app:

  • Switch to characteristic A (SWITCH_TO_A)
  • Switch to characteristic B (SWITCH_TO_B)

When SWITCH_TO_A is pressed, I modify the boolean value (that the Observable<Boolean> for B emits from) to false, so that the notifications for the B characteristic are turned off, and I reconnect to A using:

characteristicASubscription = notificationStateObservableA
    .distinctUntilChanged()
    .doOnNext {
        Log.i(TAG, "I am trying to resubscribe to char A")
    }
    .filter {it}
    .flatMap { _ ->
        sharedConnectionObservable
            ?.flatMap { it.setupNotification(CHAR_A_UUID)  }
            ?.flatMap { it }
            ?.takeUntil(
                notificationStateObservableA.filter{ enabled1 -> !enabled1}
            )
    }
    .doOnNext {
        Log.i(TAG, “Just before subscription")
    }
    .subscribe({
        Log.i("char", "Subscribed to char A")
        processPacket(it)
    },  {
        Log.i("error", "Error when connecting = " + it.printStackTrace())
    })

I also need to then change the value of the boolean value for A to true so that the subscription is triggered. I do this using a delayed instruction because I noticed otherwise it results in errors more often than not:

Handler(Looper.getMainLooper()).postDelayed({
    observableBooleanA.value = true
}, 1000)

I do the exact same thing for SWITCH_TO_B, obviously with the correct variables for characteristic B.

The problem I am having is that even with the forced delays, sometimes I get strange errors when I try to switch characteristics, such as:

com.polidea.rxandroidble2.exceptions.BleCharacteristicNotFoundException: Characteristic not found -> even though the characteristic UUID is correct

or I am getting rxAndroidBle status code 133 which then terminates my connection.

I am not able to reproduce the errors exactly which makes me think there is a race condition somewhere and I am triggering the wrong code at the wrong time. Is there a more elegant way of synchronising these apart from using delayed code?

7 replies
Fabien Demangeat
@fabiendem

Hello,

Google seems to be pushing for a new way of pairing BLE devices with the phone, using the "Companion device pairing" tool.
They want to discourage the use and need for Location access (needed for a scan) as announced here: https://android-developers.googleblog.com/2020/02/safer-location-access.html

They provide alternatives over there and suggest the use of the "Companion device pairing" to scan and pair devices
See https://developer.android.com/privacy/best-practices#location
https://developer.android.com/guide/topics/connectivity/companion-device-pairing

Finally, they push for the following timeline in https://android-developers.googleblog.com/2020/11/tips-for-getting-your-app-approved-for-background-location-access.html

If your app uses background location data, you must submit a form for review and receive approval by January 18, 2021 so your apps can stay on Google Play. Existing apps first published before April 16, 2020 have until March 29, 2021 to comply.

Now... it's all a bit confusing to me.
My app for example doesn't need Location access while in the background. We scan only while in the foreground, and the "Companion device pairing" really seems to be focused on smart watches.
But still, I am not sure to understand if we will be able to scan for devices and connect (without pairing), without this "Companion device pairing", and keeping a simple ACCESS_FINE_LOCATION.
Problem being, your app can be rejected from the store if you don't comply with their new rules.

What's your understanding of the changes?

  • is it just for smart watches and pure background location access?
  • should I worry about my use case?
  • would RxAndroidBle support this in time?

Cheers!

nihar
@ntimesc
@dariuszseweryn could you please help me on this https://stackoverflow.com/questions/65778811/how-to-enable-disable-to-notification-indication-in-rxandroidble as I am not able to disable the notification after enabling it and as per the requirement I need to enable and disable continuously to read the latest value from the characteristics , any suggestion ?
jeevankibbcom
@jeevankibbcom
Hi @dariuszseweryn how can we read a struct value and parse sent from BLE
2 replies
characteristicnotfound
@characteristicnotfound:matrix.org
[m]
Hi, i have a quick question about the implementation of the rxandroidble scanner
issue i have is that the values are not emitted by rxandroidble
i have built a boundservice that starts scanning. unless i start the scanning from the activity. the BLEscanning is running in the background
but the rxandroidble doesnt seem to get any of the values found by bluetoothadapter
1 reply
characteristicnotfound
@characteristicnotfound:matrix.org
[m]
i read the background operation wiki, but the issue is that the service should work headless
and the scanner is running in the background, its just that my scanresult observer doesnt get called
second screenshot is from the device logcat, first one is from the service application logcat output
if the app is started, and the service is then initiated
the results are flowing in
characteristicnotfound
@characteristicnotfound:matrix.org
[m]
so i can only assume this is not related to the android not allowing background scans(as the scanner is already running in the background)
i would think it has more to do with the thread. ive tried setting different schedulers in the subscribeOn/observeOn to no avail
Dariusz Seweryn
@dariuszseweryn

so i can only assume this is not related to the android not allowing background scans(as the scanner is already running in the background)

why do you assume that?

characteristicnotfound
@characteristicnotfound:matrix.org
[m]
because the scan is running in the background, why would android run the scanner and not send the results
Dariusz Seweryn
@dariuszseweryn
because privacy?
characteristicnotfound
@characteristicnotfound:matrix.org
[m]
so app registers a scanner, and the scan starts scanning, but the library is not getting those results?
everything else is working fine, automatically starting the connections and communication in the background
there is absolutely no errors.. or throwables
Dariusz Seweryn
@dariuszseweryn
Correct
characteristicnotfound
@characteristicnotfound:matrix.org
[m]
and the same thing works, as long as the "MainActivity" of the application has been opened or the service has been called while it is not created. applicationcontext
looks also the same
Dariusz Seweryn
@dariuszseweryn
I guess you want to google for android behaviour in regards to BLE scanning while the application is in background
There are several gotchas
characteristicnotfound
@characteristicnotfound:matrix.org
[m]
thank you. i will investigate further. it is just confusing that it works in the background as long as the activity has been run, even if its closed or has been removed from the recent tasks
John Fraize
@John-Fraize-Bose
Any plans to support rxjava3 ?
2 replies
lize
@ZacharyTech
Hi @dariuszseweryn , What is the recommended way to use RxAndroiddBle to connect to a bound BLE device and repeatedly request MTU?
3 replies