i've started working android framework , looking advice/design patterns use following situation:
application server/client structure. server should running @ times (or @ least recreated shortly after termination), client can close need be. accomplish server, understand want extend service
, use start_sticky
functionality , run in background.
the part i'm bit lost of how proceed want create several persistent network connections inside server. important connections threaded , can run asynchronously. lot of documents point towards using asynctask
this, don't need reference ui thread @ network threads , connections wont ever terminated, i'm hoping point me in better direction?
my conceptual idea have network threads bind service store events, , client can bind service retrieve events. i'm unsure of structure use these network threads.
the server should running @ times
there very few applications need this. statistically speaking, yours isn't 1 of them. users attack people task killers , like, plus give out one-star ratings on market harming use of device. encourage reconsider design decision.
so i'm hoping point me in better direction?
plain old ordinary java threads fine. depending on nature of threads, might consider using thread pool. part not different in other java environments. bear in mind vast majority of android devices today single-core, , have heap space (as little 16mb), having tons o' threads isn't great.
my conceptual idea have network threads bind service store events
the network threads part of service, , therefore don't need bind it.
Comments
Post a Comment