Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Docs: update documentation for 0.9.0 version
Browse files Browse the repository at this point in the history
  • Loading branch information
andriydruk committed Aug 14, 2017
1 parent 215d6c8 commit d32f2de
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 18 deletions.
155 changes: 143 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,163 @@
# RxDNSSD [![Circle CI](https://circleci.com/gh/andriydruk/RxDNSSD.svg?style=shield&circle-token=5f0cb1ee907a20bdb08aa4b073b5690afbaaabe1)](https://circleci.com/gh/andriydruk/RxDNSSD)
# Android mDNSResponder [![Circle CI](https://circleci.com/gh/andriydruk/RxDNSSD.svg?style=shield&circle-token=5f0cb1ee907a20bdb08aa4b073b5690afbaaabe1)](https://circleci.com/gh/andriydruk/RxDNSSD) [![Download](https://api.bintray.com/packages/andriydruk/maven/dnssd/images/download.svg)](https://bintray.com/andriydruk/maven/rxdnssd/_latestVersion) [![Download](https://api.bintray.com/packages/andriydruk/maven/rxdnssd/images/download.svg)](https://bintray.com/andriydruk/maven/rxdnssd/_latestVersion)

Android library which is Rx wrapper for Apple DNSSD Java API.

## Why RxDNSSD?

## Why I created this library?
My [explanation](http://andriydruk.com/post/mdnsresponder/) about why jmDNS, Android NSD Services and Google Nearby API are not good enough, and why I maintain this library.

## Hierarchy

There are two version of mDNSReposder.

Bindable version:

```
+--------------------+ +--------------------+
| RxDNSSD | | RxDNSSD2 |
+--------------------+ +--------------------+
| |
| +--------------------+ |
-->| Android Java DNSSD |<--
+--------------------+
| Apple Java DNSSD |
+------------------+ +--------------------+
| daemon.c |<-------->| mDNS Client |
+------------------+ +--------------------+
| mDNS Core |
+------------------+
| Platform Support |
+------------------+
System process Your Android app
```

Embedded version:

```
+--------------------+ +--------------------+
| RxDNSSD | | RxDNSSD2 |
+--------------------+ +--------------------+
| |
| +--------------------+ |
-->| Android Java DNSSD |<--
+--------------------+
| Apple Java DNSSD |
+--------------------+
| mDNS Client |
+--------------------+
| Embedded mDNS Core |
+--------------------+
| Platform Support |
+--------------------+
Your Android app
```

## Binaries

My dnssd library:

```groovy
compile 'com.github.andriydruk:rxdnssd:0.8.4'
compile 'com.github.andriydruk:dnssd:0.9.0'
```
* It's built with Andorid NDK r13b for all platforms (2.18 MB). If you prefer another NDK version or subset of platforms, please build it from source with command:

My rxdnssd library:

```groovy
compile 'com.github.andriydruk:rxdnssd:0.9.0'
```

My rxdnssd2 library:

```
Still in progress ...
```

* It's built with Andorid NDK r14b for all platforms (2.18 MB). If you prefer another NDK version or subset of platforms, please build it from source with command:

```groovy
./gradlew clean build
```

## How to use

RxDNSSD provides two implementations of RxDnssd interface:
### DNSSD

- RxDnssdBindable
- RxDnssdEmbedded
Dnssd library provides two implementations of DNSSD interface:

RxDnssdBindable is an implementation of RxDnssd with system's daemon. Use it for Android project with min API higher than 4.1 for an economy of battery consumption (Also some Samsung devices can don't work with this implementation).
DNSSDBindable is an implementation of DNSSD with system's daemon. Use it for Android project with min API higher than 4.1 for an economy of battery consumption (Also some Samsung devices can don't work with this implementation).

```java
RxDnssd rxdnssd = new RxDnssdBindable(context);
```
DNSSD dnssd = new DNSSDBindable(context);
```

RxDnssdEmbedded is an implementation of RxDnssd with embedded DNS-SD core. Can be used for any Android device with min API higher than Android 4.0.
DNSSDEmbedded is an implementation of RxDnssd with embedded DNS-SD core. Can be used for any Android device with min API higher than Android 4.0.

```
DNSSD dnssd = new DNSSDEmbedded();
```

##### Register service
```java
try {
registerService = dnssd.register("service_name", "_rxdnssd._tcp", 123,
new RegisterListener() {

@Override
public void serviceRegistered(DNSSDRegistration registration, int flags,
String serviceName, String regType, String domain) {
Log.i("TAG", "Register successfully ");
}

@Override
public void operationFailed(DNSSDService service, int errorCode) {
Log.e("TAG", "error " + errorCode);
}
});
} catch (DNSSDException e) {
Log.e("TAG", "error", e);
}
```

##### Browse services example
```java
try {
browseService = dnssd.browse("_rxdnssd._tcp", new BrowseListener() {

@Override
public void serviceFound(DNSSDService browser, int flags, int ifIndex,
final String serviceName, String regType, String domain) {
Log.i("TAG", "Found " + serviceName);
}

@Override
public void serviceLost(DNSSDService browser, int flags, int ifIndex,
String serviceName, String regType, String domain) {
Log.i("TAG", "Lost " + serviceName);
}

@Override
public void operationFailed(DNSSDService service, int errorCode) {
Log.e("TAG", "error: " + errorCode);
}
});
} catch (DNSSDException e) {
Log.e("TAG", "error", e);
}
```

You can find more samples in app inside this repository.

### RxDNSSD

RxDNSSD also provides two implementations of RxDnssd interface:

- RxDnssdBindable
```
RxDnssd rxdnssd = new RxDnssdBindable(context);
```
- RxDnssdEmbedded
```
RxDnssd rxdnssd = new RxDnssdEmbedded();
```

Expand Down Expand Up @@ -65,6 +192,10 @@ Subscription subscription = rxDnssd.browse("_http._tcp", "local.")
});
```

### RxDNSSD2

Still in progress ... (I recieve PR 😉)

License
-------
Copyright (C) 2016 Andriy Druk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void onClick(View v) {

};

RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(mServiceAdapter);
}
Expand Down
6 changes: 1 addition & 5 deletions rxdnssd/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

repositories {
mavenCentral()
}

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
Expand All @@ -29,7 +25,7 @@ android {
}

dependencies {
compile project(':library')
compile 'com.github.andriydruk:dnssd:0.9.0'

compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.3.0'
Expand Down
2 changes: 2 additions & 0 deletions rxdnssd/src/main/java/com/github/druk/rxdnssd/RxDnssd.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import android.support.annotation.NonNull;

import com.github.druk.dnssd.DNSSD;

import rx.Observable;

/**
Expand Down

0 comments on commit d32f2de

Please sign in to comment.