I have a background service, which was bound and started from main
activity:

Intent intent = new Intent(MyService.class.getName());
startService(intent);
bindService(intent, serviceConnection, 0);

When activity started, service has benn created(Service onCreate is
called). When user click back,
and executes application again, activity get`s bounded to service
again (but this time, whithout calling onCreate method. Why??? I mean,
how android knows, that service don`t need to be created?)

That`s behaviour is ok for me.

I create:
public class BootReceiver extends BroadcastReceiver

which start service on mobile boot completed:

Intent serviceIntent = new Intent(MyService.class.getName());
context.startService(serviceIntent);

Method MyService.onCreate is called. Service is started.
BUT, when user executed application MyService.onCreate is called
again. And I assume, that I have 2 instances of one service. How can I
manage this situation? Thank you.

-- 
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