Using LDAP on Android

Mobile devices are quickly becoming indispensable tools for convenience and productivity wherever you may happen to be. Around the beginning of the year, I started to look at the Android platform for developing applications for mobile devices (and other low-end kinds of systems). I picked up a Google developer phone (basically an unlocked version of the T-Mobile G1) and was impressed by the pretty rich API that it offers. Quite a large portion of Java SE is available for use, although there are some notable exceptions. For example, it’s missing all of the GUI classes, but that makes sense since Android provides its own GUI library. But another significant omission is that of JNDI, which is the API included in Java SE for communicating with LDAP directories.

On one hand, this is a good thing since JNDI is a horrible API that is inconvenient to use and doesn’t provide very good access to the LDAP protocol, and the less opportunity there is to use it the better. But on the other hand, being able to communicate with an LDAP directory server on a mobile device can be extremely helpful. For example, it could be very convenient to have access to the entire corporate directory at your fingertips for phone numbers and e-mail addresses without the need to clutter your contacts list, or maybe to keep local contacts in sync with their corresponding entries from the corporate directory.

The good news, though, is that Android developers don’t need to worry about missing LDAP support for Android because the UnboundID LDAP SDK for Java works just fine on the Android platform. I’ve done quite a bit of testing and made sure that things just work. With a couple of exceptions (primarily CRAM-MD5, DIGEST-MD5, and GSSAPI, which require the Java SASL API that isn’t available on Android) pretty much all of the functionality that we offer in our LDAP SDK can be used on Android. This includes all of the core protocol, all of the controls and extended operations, SSL/StartTLS, connection pooling, and all the other stuff is there, too. Note that there is no special “Android” version of the LDAP SDK — the same SDK that you can use for writing desktop clients or server-side applications works without any changes on the Android platform.

To demonstrate this capability, I’ve put together a simple LDAP client for Android devices. You can see a video online at http://www.youtube.com/watch?v=1NlhwrcCeSQ.

13 thoughts on “Using LDAP on Android

  1. I need to do a little cleanup, and will then make it available in the Android Market. The source will also be included as an example with the next release of the LDAP SDK (although the current release of the LDAP SDK may be used for Android development).

    Like

  2. Great news! I have been looking for this. Can you send me/us a mail or leave a message here when the app will be ready?Is it possible to do a batch import of all contacts from the LDAP/MSAD with the app? It could be fantastic…

    Like

  3. Android does not use Java SE. It uses a custom version of Java that is a large subset of Java SE, but there are some things that are in Java SE but not available on Android (like JNDI, AWT, and Swing), and there are some things on Android that aren’t in Java SE (like Android-specific APIs for GUI interaction, interacting with the device, etc.). Also, Android uses an interesting mechanism for passing information between components of your application, and there are some requirements that JNDI may or may not meet but we specifically support in the UnboundID SDK.But beyond that, JNDI is such an immensely horrible API, that I can’t imagine anyone wanting to use it when there are better alternatives. I think that Android has done the world a service by not making it available.

    Like

  4. Is any one succeeded in Reset password of an Active Directory user using UnboundID API. If so, could you please let me know the approach please…

    Like

  5. The question about Active Directory really doesn't have anything to do with Android, so it's not really appropriate here. The best place to ask questions or provide other feedback about the UnboundID LDAP SDK for Java is to use one of the mailing lists or the discussion forum, as described at http://www.unboundid.com/products/ldapsdk/docs/help.php.The answer to your question is a little more complex than should be answered in a comment, so I created a new blog post that outlines the requirements and includes a code example. You can find it at http://www.dirmgr.com/ADPasswordChanges.

    Like

  6. Just search for "LDAP Client" in the Android Market. If you want to build and install it for yourself, then download the LDAP SDK and see the README in the android-ldap-client directory.

    Like

  7. I really appreciate the LDAP Client Android application; it's great for searching. I noticed a glitch, however. When I select "add to contacts", the application locks up and must be "force quit". My contacts use the "mozillaAbPersonAlpha" schema, if that makes any difference. Thanks!

    Like

Comments are closed.