You can try to code, and then post the problem you encounter.

On 10月17日, 下午1时10分, pink 444 <pnk...@gmail.com> wrote:
> Thanks for your replay.
>
> Can you give me a example .
>
> On Oct 16, 2:55 pm, Farproc <farp...@gmail.com> wrote:
>
>
>
> >   First, you do not have to start/stop aservicefrom a Activity. You
> > can
> > do that in anywhere via a Context object(which is very easy to
> > retrieve).
>
> >   If you want to start aservice, just call Context.startService(),
> > form
> > then on theservicewill keep running in background until you
> > explicitly
> > call Context.stopService(). Then call Context.bindService() if you
> > want
> > to control theserviceand Context.unbindService() when you do not
> > want to communicate with theserviceanymore.
>
> >   Finally, Call Context.stopService() to terminate theservicewhen it
> > is
> > not needed.
>
> >   ps: Though aserviceruns in "background", it runs in the main(UI)
> > thread.
>
> > On 10月16日, 下午12时38分, pink 444 <pnk...@gmail.com> wrote:
>
> > > Hai,
>
> > >      My application has a background process which continuously waits
> > > on a  socket for receiving messages and it should be started only once
> > > and at the time of application starting.Thus i want to do that
> > > background job in aservice.
>
> > >     Theserviceshould not be started from the  activity ,it should be
> > > started at the application starting.
>
> > >     How can i define theservice,which will be started at the time of
> > > application starting?
>
> > >    If at all theserviceis started from activity.The activity can be
> > > destroyed
> > > and restarted.when this happens theservicealso be restarted .
>
> > > Any help will be appreciated highly.
>
> > > Thanks,
> > > -SIva.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to