How to create an extension in XMPP(smack) and implement?

  1. I have to implement a vehicle tracking application and i need to implement my own extension for that…

  2. My prototype extension would look like below

  3.   <latitude>19.49</latitude>
  4.   <longitude>12.45</longitude>

What all classes i have to create and how should i integrate with smack to get this done.

Can some one point me to the correct resources.

Thanks in advance…

It is pretty simple.

  1. You have to create your own implementation of the PacketExtension interface. This class will represent your actual location data as you have defined.
  2. Create a PacketExtensionProvider. This class is used to parse the xml as it is received and create your specific PacketExtension. I would recommend extending EmbeddedExtensionProvider. The javadoc for that class will explain how to use it and register your provider. Your provider can also be registered by code using the ProviderManager directly.