andriydruk / RxDNSSD

Android version of mDNSResponder
Apache License 2.0
297 stars 75 forks source link

How to continuously TXT records by using 0.9.13? #187

Closed githubforzjm closed 3 years ago

githubforzjm commented 3 years ago
browseDisposable = rxDnssd.browse(registerType, "")
            .compose(rxDnssd.resolve())
            .compose(rxDnssd.queryIPV4Records())
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(bonjourService -> {
                if (bonjourService.isLost()) {
                    BonjourLog.i(TAG, "thread:" + logThreadId() + "serviceLost: " + bonjourService.toString());
                } else {
                    BonjourLog.i(TAG, "thread:" + logThreadId() + "serviceFound: " + bonjourService.toString());

                    rxDnssd.queryTXTRecords(bonjourService)
                            .subscribeOn(Schedulers.io())
                            .observeOn(AndroidSchedulers.mainThread())
                            .subscribe(service -> {
                                BonjourLog.i(TAG, "thread:" + logThreadId() + "TXTRecords changed: " + service.toString());
                            }, throwable -> {
                                throwable.printStackTrace();
                                BonjourLog.i(TAG, "thread:" + logThreadId() + "TXTRecords: " + throwable.getLocalizedMessage());

                            });

                }
            }, throwable -> {
                throwable.printStackTrace();
                BonjourLog.i(TAG, "thread:" + logThreadId() + "Error: " + throwable.getLocalizedMessage());
            });
githubforzjm commented 3 years ago

@andriydruk Can you provide some sample code for me to test?Thanks.

githubforzjm commented 3 years ago

@andriydruk Merry Christmas!!! Any suggestions on this question? Thanks!!

andriydruk commented 3 years ago

Hi, It looks like a bug. Your code should work well. I pushed fix in #191