android - A Local Service implementation closely related to Application Life Cycle -
android - A Local Service implementation closely related to Application Life Cycle -
in app. have extended application class myapp, , have few activities a,b,c,d default activity or root activity. want start service (say myservice) within oncreate of myapp , stop when user logs out application,
however need strong way communicate between activities (a,b,c,d), myapp , myservice. application launched sec time memory. oncreate of myapp not called start service onclick of signin button within activity a. have number of questions :-
i have tried both startservice , bindservice problem startservice don't service reference future use. if utilize bindservice create service visible through out application life cycle till explicitly stop it. way applicable in case ?
what best way implement communication between service , myapp / activities , vice verse ? communication mean 2 type of communication, 1. needs ui thread i.e. start activity, show dialog etc. 2. myservice.dosomehing().
the service has thread network communication should not closed during life time of application. start_sticky work me or need create arrangements that.
this app supposed run gingerbread+ devices...
bind service within extended app oncreate , create public method (getbinding) returns binding object ... in root/default activity 'a' oncreate via getbinding method on casted getapplication object retrieve .. unbind when activities close (keep counter each getbinding method)
check cleanly binding/unbinding service in application
so 1) bind service 2) binding obj 3) start sticky enough
android android-activity android-service
Comments
Post a Comment