I want to develop an
            Android application that satisfies the following
            specifications:
- Record
data from a sensor (for example the accelerometer) at an
approximate rate of
10-30 Hz. - Upload this raw data to a remote server (for
example using TCP
sockets). - The user interface
should be minimum, just a pair of buttons to start
or stop the recording and
transmission of the data. - All the process
should be unnoticeable for the user and keep working
when the screen goes off
for several hours. - Battery life is not critical (it
should last several
hours). 
Vision: I would
            like to analyse in quasi-real time the sensor measurements of a group of users without
            their intervention (apart from starting the
            application).
After some research, I could
            manage to perform these tasks separately and inefficiently. I've tried classes such as
            Service and IntentService, SensorEventListener, etc. I don't know if I should use
            Thread, Service or IntentService for each task. Specifically, I have serious problems to
            communicate them.
My questions:
            
- What class(es)
do you recommend to use in order to solve
this
problem? - What task should be done on each
of them? - If the tasks are performed in different entities
(threads, services,
intentservices, etc.), how should I intercommunicate them
(I'm
thinking about the recording and uploading
tasks)? 
I am
            asking for the best-practice structure to solve my problem. You do not need to go into
            details in terms of developing/coding the
            solution.
Thank you very much and feel free to
            ask if something is not clear
            enough.
David
UPDATE:
After
            some more research and thanks to DROIDcoder, I manage to design a skeleton for my
            app:
- Main UI:
Activity object presenting two buttons (start/stop) that
will launch a Service
with the usual startService/stopService
methods - Background: Service
object 
As
            this is only a proposition, I add it as an edition. I will post a detailed answer when
            the whole system works.
The questions
            remains: can you think about a better design for the
            application?
Thanks again!
No comments:
Post a Comment