tags:

views:

19

answers:

0

Hello,

I want to create Service using bindService method. But when I close one Activity my Service is destroyed, I don't want that.

I try to put service foreground using startForeground(NOTIFICATION_ID, notification); service onCreate , but service still destroy.

Now I try with call two methods for starting Service at same time :

    Intent bindIntent= new Intent(this, ServiceC.class);
    startService(bindIntent);
    bindService(bindIntent, onService, BIND_AUTO_CREATE);

With calling this two methods Service not destroyed. My app work fine at this method.

Can someone explain to me whether this is a good way or if is not can you please give me idea why startForeground(NOTIFICATION_ID, notification); not work ?

Who is the best way to use bindService but in same time I don't want to service self destroy.

Thanks!!!