On Jul 28, 2011, at 6:56 AM, was wrote:
> I'm looking to use ZeroConf over Wi-Fi as we do in our iPhone apps.
Do you use a managed library for that, or a wrapper over native code? If it's a
managed library, you may be able to use it as-is without using jmDNS.
> From googling, I understand that jmDNS has to be used, but I can't figure out
> how
> to use it in Monodroid - or even if it's possible?
How hard to you want to work? ;-)
What the support email stated is still largely true: there is currently no
_simple_ way to use .jar files at this time.
This doesn't mean that it's impossible; there are at least two ways to do so:
1. Write custom Java code.
2. Use Android.Runtime.JNIEnv (which may also be needed for (1)).
In both cases you would add the jmDNS .jar file to your project and set its
Build action to AndroidJavaSource.
If the jmDNS API can be used solely via object instantiation and method
invocation, you can then use the Android.Runtime.JNIEnv type to instantiate
types and invoke methods on them; see:
http://android.xamarin.com/Documentation/API_Design#Java_Native_Interface_Support
(It's brutal, but it works.)
If the jmDNS API requires inheritance (e.g. to override abstract methods, etc.)
then you'll need to write some Java code to use the type, set the Build action
for your Java source code to AndroidJavaSource, and then you can use JNIEnv to
use your custom type. You can somewhat see this in action with the GoogleMaps
sample:
https://github.com/mono/monodroid-samples/tree/master/GoogleMaps
However, GoogleMaps uses Context.startActivity() to navigate between the Java
activity and the C# activity, instead of using JNIEnv, but many of the concepts
are the same.
This will be improved in a future release; we're still working on the tooling
for .jar support.
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid