Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 android 中使用 NSD api 注册服务,但我不确定如何添加 TXT 记录?
从 Android 5.0 开始应该是这样的:
... if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { serviceInfo.setAttribute("yourkey", yourString); } ....
我得到了解决方案:NSD api 仍然不支持添加 TXT 记录。我通过移植 jMDNS 制定了一个解决方案,它是一个简单的 java 实现,几乎支持 mDNS 上的所有功能。