Use OpenFire for geolocation

Hi,

I need some help. I’m completely new to developing on OpenFire (actualy any kind of server development) and to Smack API.

In my academic project I need to create a client-server application (client on Android) that enables server to track client geolocation. As I have gathered yet XEP-0080 would be the solution. I have to use XMPP protocol just for that, I don’t need it for any chat, presence or other IM stuff.

I’ve googled much and know that there is no official support for XEP-0080. But I need some basic pointers for doing this.

On the client side I have to use SmackAPI, that I know. But what to I have to do on server side, on the OpenFire itself? Do I have to create a new plug-in for it? How do plug-ins work in general? I develop my own and integrate it on the server (install it) and it’s always running or something else?

I know these are really novice questions, but I really need some help, just a few starting pointers. I have experience in Java programming and developing apps for Android, but no experience in server side of things.

Any kind of help is welcome, any kind at all.

Thanks in advance

Hi,

as far as I understand XEP-0080 there’s nothing which must be implemented on server side as long as the XMPP server supports Pubsub and PEP. Openfire supports this so it’s only a client issue to implement XEP-0080.

LG

From what I can see, you can do this easily with the pubsub API in Smack by simply creating a UserLocation payload class that can be used both to publish and handle events. This would simply be an extension of the PacketExtension class and then you would only need a provider class to parse the incoming events and reconstruct your UserLocation class.

Some sample code can be seen here in the test cases for the pubsub extension in Smack.

You could also use the existing SimplePayload class to both send and receive, as it will carry your xml data, but then you would have to parse that xml into something meaningful to actually use it. This is why I recommend the first approach since it does that for you and you can avoid directly using xml altogether.

This does require Smack from the source code though, since that API is not in the latest release version.

Hi,

we at buddycloud.com do some geoloc stuff via pubsub! You may just join our groupchat at** seehaus@channels.buddycloud.com**

It’s actually the reason that asmack exists, so feel free to get some input on geoloc, pubsub and pep there :slight_smile: The server implementation is actually all about managing pubsub nodes…

Thank you all for your help. I have another question. For my application, that consist of only one client and a server (for what I have to do for now), the client has to send it’s geolocation to the server. The server than has to see if the user has left a certain radius from his “home location” and send a some message to the client. For that, I have to create a plugin for OpenFire, right? Now, how do I send message from user to server ( I’ll client’s geolocation using a class that I have created that extends the standard Message class)? Do I simply create a listener on sever (in the plugin) or that has to be done some other way?

Thanks for your further help

Look at XMPP components. Use a custom component jid (location.myserver.com) and simply send a geoloc (or a custom stanza) to the component. You can do whatever you want on receive and you don’t have to mess with the server environment.

Can you please give me any kind of example? How to use these components?

What do I do? Simply create a Java class that implements Component, define in it what I want it to do when my custom Message is received?

Any kind of example will help me, since I can’t find any on the web

thanks in advance