0

I have an application that communicates with socket.

I want bind socket service to the communication activity. But if the activity closed, the service destoryed.

How can I keep the socket service running whatever the activity is open or closed?

If I started notification to my application when the activity stopped, the service is running or not?

Nirali
  • 13,571
  • 6
  • 40
  • 53
Whistler
  • 97
  • 1
  • 8

3 Answers3

0

You can start your Service according to your requirement.

Please go through http://developer.android.com/guide/components/services.html

Saurabh Verma
  • 6,328
  • 12
  • 52
  • 84
  • use the startService method with my app?I need exchange data from service to the activity.I think that Broadcast Receiver could do that. Whether my app was killed by system when memory is low? – Whistler Jul 31 '12 at 07:35
0

You have to use Broadcast Receiver, Alarm Manager and Service for this functionality,

Refer below post

AlarmManager, BroadcastReceiver and Service not working

Community
  • 1
  • 1
Nirali
  • 13,571
  • 6
  • 40
  • 53
0

You can start service in Another process than your application by android:process tag.

jeet
  • 29,001
  • 6
  • 52
  • 53