Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Android Network Service Discovery Rx CircleCI

An Rx wrapper around the Android NsdManager api.

Install

implementation 'com.ToxicBakery.library.nsd.rx:android-nsd-rx:1.+'

Creating a Manager

The NsdManagerRx can be created with a context instance.

NsdManagerRx.fromContext(context)

Discovery

The service name used is defined in rfc6763 and finds all services without filtering. ietf.org/rfc/rfc6763.txt

NsdManagerRx(context)
    .discoverServices(DiscoveryConfiguration("_services._dns-sd._udp"))
    .subscribe({event: DiscoveryEvent -> Log.d("Discovery", "${event.service.serviceName}")})

Register

NsdManagerRx(context)
    .registerService(RegistrationConfiguration(port = 12345))
    .subscribe({event: RegistrationEvent ->
        Log.d("Registration", "Registered ${event.nsdServiceInfo.serviceName}")
    })

Resolve

NsdManagerRx(context)
    .resolveService(serviceInfo)
    .subscribe({event: ResolveEvent ->
        Log.d("Resolve", "Resolved ${event.nsdServiceInfo.serviceName}")
    })

Binders

Discovery and registration return binders in their events. The binders allow the internal listener to be unregistered without disposing the observable. This is important if you want to receive the unregister and stop events from the Android NsdManager. Alternately, disposing of the observables will unregister the internal listeners.

Demo App

The demo app provides a quick way to run the NSD service against your connected network.

Demo Application Screenshot

You can’t perform that action at this time.