Multiple Broadcast Messages with Less Data or Less Broadcast Messages with More Data?
Posted
by niko
on Stack Overflow
See other posts from Stack Overflow
or by niko
Published on 2009-10-05T15:57:19Z
Indexed on
2010/04/14
14:03 UTC
Read the original article
Hit count: 297
android
|broadcastreceiver
Hi,
I am developing an application which is communicating with the server. Tha application can perform log-in and get different parameters from server.
The application consists of a RESTful client (custom class for making requests), Communication Service (the service which runs in the background) and the main activity.
For now I created multiple broadcast messages and multiple broadcast receivers in the main activity so when the application performs login operation a receiver (loginBroadcastReceiver) in the main activity receives a message and when another parameter is received from the server different message is broadcasted and another receiver handles the message.
This way however the application performance is poor but I am not sure whether it is due to multiple broadcast receivers.
Does anyone know what is the best way to exchange data between service and main activity - is it better to create a single broadcast receiver and retrieve all parameters from message or is it better to initialize multiple broadcast receivers for multiple parameters?
I would appreciate if you could provide any useful resource about the topic because I'm writing the thesis and it would be good if the solution could be explained.
© Stack Overflow or respective owner