AnsweredAssumed Answered

Android service & application: Architectural question

Question asked by ssougnez on Aug 17, 2014
Latest reply on Aug 18, 2014 by ssougnez



yesterday, I've been able to install an OpenFire server and developp a tiny Android application to be able to use it (with asmack of course). Now, before starting my real app, I'm wondering something and I don't know how to find a precise answer, so I'm posting here


Actually, let's imagine that I want to build whatsapp ( I think (correct me if I'm wrong) that this app would be separated in two component: the application to actually chat and a service that would maintain a XMPP connection with the server and would send notifications to the phone when a new message is received.


I see how it would work when the application is not running. The service has the connection, receives messages and sends notifications, but what happened when the user is opening the application itself? The application should have a XMPP connection to be able to receive new messages, but what happen to the connection of the service ? It's disconnected or this one doesn't create any notifications because the service "knows" that the application is currently running ? Or is there a way to prioritize (not sure of this word ) connections to say "ok, the connection A is more important than the connection B so all messages will be received on A and not on B", etc...


To be honest, I don't really know what is possible and what would be the best option so if someone could give me a hint or maybe a link to an article explaining that, it would be very useful.