android dns-sd,GitHub - orenk86/AndroidDnssdDemo: Example use of Dnssd discovery on Android (using j...

本文档详细介绍了如何在Eclipse和NetBeans中设置AndroidDnssdDiscovery项目,以便在Android应用中实现Bonjour(Zeroconf)服务发现。步骤包括创建Android项目,添加依赖库,修改AndroidManifest.xml,以及运行和测试项目。通过这些步骤,可以在同一网络中的Linux PC和Android设备之间进行Bonjour服务的查找和发布。
摘要由CSDN通过智能技术生成

AndroidDnssdDiscoveryEclipse: an eclipse version.

AndroidDnssdDiscovery: a netbeans version of the thing.

Below, how I got the AndroidDnssdDiscoveryEclipse project and how to run it.

* create an android project

* in the AndroidManifest.mf, add:

* after downloading jmdns 3.4.0, I needed to remove duplicate .class inside (at the same time I dropped the test classes):

** run: cp -r ~/jmdns.jar ./

** run: mkdir unjar

** run: cd unjar

** run: jar xf ../jmdns.jar

** run: jar cfm ../jmdns.jar META-INF/MANIFEST.MF javax/

** (create a copy or link for eclipse), run: cd ../AndroidDnssdDiscoveryEclipse && ln -s ../jmdns.jar

* refresh the project in eclipse

* add the jar as a dependency in eclipse by (right click on jmdns.jar and "build path -> add to build path"

* add info in the res/layout/main.xml:

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="" />

* fill the activity

* In eclipse, "run as -> android application"

** if you have a linux pc connected to same network, you should see it listed by your android phone within a few seconds (as it exposes a "_workstation._tcp" service)

** you should also see the service exposed by the phone using "avahi-browse --all" (the service is called AndroidTest)

== OLD VERSION BELOW (before I found the problem with jmdns)

* create an android project

* in the AndroidManifest.mf, add:

* after downloading jmdns 3.4.0 and finding no way to make dex compile the jar, I added the sources with:

** run: cp -r ~/app/jmdns-3.4.0/src/javax/ AndroidDnssdDiscoveryEclipse/src/

** run: rm -rf AndroidDnssdDiscoveryEclipse/src/javax/jmdns/test/

** refresh in eclipse

* add info in the res/layout/main.xml:

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="" />

* fill the activity

* In eclipse, "run as -> android application"

** if you have a linux pc connected to same network, you should see it listed by your android phone within a few seconds (as it exposes a "_workstation._tcp" service)

** you should also see the service exposed by the phone using "avahi-browse --all" (the service is called AndroidTest)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值