0

I'm fetching data from a backend server using a Service which I started from Activity A and when the right data comes in, I start an Activity B from within the service.

My question is : Is it possible to start the service from Activty A and then when Activity B is running bind the service it to use callback methodes from the service and when Activity is in background unbind the Service and keep it running?

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
  • very much possible, services are independent components. – Sush Mar 02 '18 at 17:03
  • so i just call the startService from the first activity and bind it to the second Activity there is no special approach ??? – Houssem Ezzine Mar 02 '18 at 17:10
  • Yes, see [Android Service bind](https://stackoverflow.com/questions/5819368/android-service-can-be-bind-without-start) and [Calling activity class method from Service class](https://stackoverflow.com/questions/23586031/calling-activity-class-method-from-service-class) – Jon Goodwin Mar 02 '18 at 17:11

0 Answers0