Quantcast
Channel: Ignite Realtime: Message List
Viewing all articles
Browse latest Browse all 11413

Re: Android service & application: Architectural question

$
0
0

I'm sorry, I think I'm very unclear about what I mean. I'll try to be as clear as possible.

 

Does it really say "application" and not "process"?

 

Indeed, it says process. So, currently, my application is composed by some activities (a main one and some other for registration, login, etc...) and a service. This one is just a simple class that inherits from Service. So far, it is a service that launches itself every 5 minutes (because this service is not the chat one but a service that executes a task periodically) but I guess that the service I'll have to create for the chat will be the same kind except that this service won't "never stop" (except if Android shut it down).

 

Depends on what you mean with "app". Android just knows processes and components.

 

For me, the app is the graphical interface. On my Galaxy S5, when I press the bottom left key, I see a list of every applications still running (but services are not displayed there). Therefore, my activity is displayed there but not my service. If I kill every apps shown in there, my acticity is killed but my service is still running.

 

Why is it closed?

 

Imagine this scenrio.

 

- The user starts the application.

- He chats a bit and then reduces the application.

- Then he goes in the running application list and kill every running applications.

 

Here, the service will still listen the XMPP connection but the application (so the main activity) won't be running anymore. In this case, when a packet is received on the connection, the service displays a notification (I guess). Imagine now that the user opens the application... Now, the service must still listen for packets but when it receives one, it must "tell it" to the application and not display a notification (when you are in a chat, you don't want to receive a notification... as you are in the chat).

 

I don't know if I'm clear but don't hesitate to correct me on some points if I'm wrong.

 

EDIT:

 

Waiting for some news in this topic, I started the mentionned service. So I create a class that extends Service and in it, I created a XMPPTCPConnection. When I reiceved a message, it diplays a notification that opens the application when I click on it. Currently, it opens the home activity but I guess I can pass some information to it for it to open the correct chat window.

 

Then, here is the question I asked above. If the chat window is open, the service must react differently. Instead of displaying a notification, it must send the new message to the chat window for this one to display it. Moreover, no notification should appear. This is exactly the question I cannot find an answer to. How the service can know that the chat window is opened and can it send "message" to it for the chat window to display them?

 

Thanks a lot for your help


Viewing all articles
Browse latest Browse all 11413

Trending Articles