Jeffrey Peacock
unread,Jan 17, 2017, 11:53:23 PM1/17/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to socal-...@googlegroups.com
I want to work up to a full discussion of structuring a complex Android
application. But I think we need to start with some individual
components that immediately complicate the structure of Android
applications. My favorite is Services, what work they do, and how that
data they manage is shared with Activity's so that users can interact
with it.
So, consider a Stock portfolio app. It needs a Service running in the
background that periodically connects to a server in the cloud, gets
pricing data, and stores it in a DB.
The launcher Activity is the gateway into the full app. By default it
displays the a perspective of the data the Service has been collecting.
For simplicity let's say this is a (Initially) list of stocks and their
current prices, daily trade volumes, and movement (increase/decrease)
from their last trade.
1) Once the Activity is bound to the Service how should it obtain
access to the data the Service is managing? Simple method calls or via
a content provider to the DB the Service is managing? Other?
2) If the Service is local then simple method calls happen in the same
process space and are not IPC. If the Service is remote -- perhaps the
Service is intended to "public" and available to more than just my
application -- then method calls happen through IPC which is reminiscent
of RMI, and the old RPC that RMI was derived from. This can present a
problem for data whose size is not well understood. So how might we
adjust our access to the Service when it is a remote Service -- i.e.,
runs in separate process space than the Activity.
3) For IPC: Has anyone used the Handler class and the messenger idiom
demonstrated/suggested in the Google Android docs? Why?
4) How does the "periodic update" -- i.e., our interval -- of our stock
data effect the liveness of our Service. For example, if I only get
stock updates once an hour then what mechanisms are available to me to
control this? If we get updates once every 10secs (which we wouldn't
actually do under normal circumstances), how does that change the
mechanisms we use to implement/manage our Service? Android has timing
mechanisms and so does Java.
Hopefully that is enough to get the discussion rolling.
/J