0

I need help with something fairly basic I am having trouble understanding after a few hours of research and reading.

I have:

Service
   -Thread
       Method: write(string)

I need to pass a variable string from MainActivity to service and call write(string) when string changes. I started to implement a broadcast receiver in the main service but how do I call write(string) method from the main service? Do I need to put the receiver in the thread instead? I'm having a hard time understanding what I'm doing here. Please let me know if there is a better way.

The service contains all the Bluetooth connection and send/receive code. I plan in the future to have another service send data to the Bluetooth service to send to the BT device.

naps1saps
  • 373
  • 5
  • 14

1 Answers1

0

I am still a beginner at Android too but I think what you are looking for are Bound Services. There is also a related question here.

jimdoesnotgym
  • 77
  • 1
  • 10