Mobile 2.0 - Smack as integral part of Android Browser

The time has come for XMPP and HTTP to work hand in hand in the Browser. This major shift will first happen in Mobile 2.0 space and then will come to the desktop.

To act on this idea our company, Lablz has recently participated in Android Developer Challenge I (ADC I) . We integrated Smack and WebKit on Android and released Lablz Bhoost Browser Shell into open source on Google Code

We have met with a lot of problems while porting Smack to Android. And we would like to give back to Jive and community our experience and patches. Debugging in Android emulator was quite a challenge, so we have also setup our code as an Applet in desktop browsers. Unfortunately we met a different set of problems running Smack in Applet. Again we would like to share the pain and the patches.

What would be the proper way to approach this project - keep in mind this is not one small issue, but a whole set of problems we had to overcome. We were successful in making Smack work in both environments, although we are not sure we did the changes properly. We are willing to spend time on this with Jive people, but we will need your support.

We plan to continue work on uniting Web & XMPP and will participate in ADC II (end of 2008). If Jive and/or community is interested in collaboration on Bhoost for ADC II - we would be happy to work together.

Some background - Lablz was established in 2000 with the singular mission of implementing the Tim Berners Lee’s vision of Web as a Database. We have created a way for developers to build business and consumer Web applications without functional programming - just by describing the domain model in Java. The end result is that complex applications, like SPA Management, Supply Chain management end up 1000 times smaller. We know that for a fact since we developed them, deployed in real life settings and evolved for several years. There are companies in 20 countries using our Web applications built on this Web 3.0 foundation.

Well, we can start with patches. If possible, can you break the patches up into manageable sections, and give a good explanation of whats going on? Full patch would be ok too. Also, Jive has a contributer agreement in order to put your changes into Smack itself, one of the Jivers can help you out with that process.


Thank you for your response. Here is some points on Android, will post more later.

  1. First we applied the patch supplied by davanum.

This replaced dependency on xml the parser with the one that was

already on android - kxml2 and solved a bunch of other problems. If

patch is not obvious to your engineers and davanum can not help I will

try to recall what the problems were.

  1. Android has a nasty

Java incompatiblity - getResource() and/or getResourceAsStream() does

not work, thus smack.providers and other config files are not read

which leads to numerous ClassCastExceptions and NullPointerExceptions

when using Group Chat. We attempted to fix those places (which will be

reflected in the patch) but there were too many and we gave up and

applied solution similar to the one described here.

Our engineer who worked on this problem created smack providers package

and did initialization in Java source instead of the config file. This

was very laborious. Some provider classes needed to be instantiated,

others had to be supplied as .class. It took a long time of try and

test to figure out which should we which. May be there is a better way

  • but we did not find it. I will

supply both providers package and initialization code.

  1. The bunch of the problems was related to the fact that Smack API

throws unchecked exceptions way too often. This happens for example

with different connection/login states that Smack finds improper.

Because exception is unchecked - we had to find all those places at the

runtime, not compile time. On Android - when exception is uncaught -

the Activity or Service just dies and this makes the application stop

responding or not receiving messages anymore.

  1. I will try to gather and categorize other problems, but it was so

fast paced hacking that forgive us if some details were lost or problem

not investigated to its root. We needed to meet the ADC I Apr 14


I will post separately on numerous Applet issues. We have also met the problems with use of Smack in Servet environment. I will also post separately.