Office Hours — Today, June 27

Saturday, June 24

Mark M.
has entered the room
Mark M.
turned on guest access
Steve S.
has entered the room
Mark M.
hello, Steve!
how can I help you today?
Steve S.
Hi, Mark!
I wanted to follow up with you regarding the Bluetooth service I'm working on
Based on discussions we've had in the past, I know I need to allow for the possibility that the service will be (temporarily) shut down by the system from time to time.
One question is:
What is the best way to tell whether the service is running so I can check that before trying to send a message via Bluetooth?
Mark M.
why do you need to know if the service is running before trying to send a message via Bluetooth
?
I don't remember the details of your service, but, in general, if you want to ensure that the service is running, call startService()
Jun 27
7:30 PM
Steve S.
Messages are used to start a brew operation (this is for a coffee brewer). There shouldn't be a delay between pressing the button and sending the message from the app to the microcontroller.
Mark M.
so, don't enable the button until you have established whatever sort of communications you are doing with the service
Steve S.
Sure
What I'm referring to are cases where the system brings down the service e.g. for garbage collection
Mark M.
is the service in a separate process from the UI?
Steve S.
No
Mark M.
then *everything* is gone
there is no "brings down the service"
unless you stop the service yourself, of course
Steve S.
ok
Mark M.
Android won't do that individually automatically -- it terminates the whole process
and so long as your UI is in the foreground, Android should not do that, outside of a very sick environment
so, if the UI and the service are in the same process, they represent an atomic unit of stuff
Steve S.
Ok. So as long as the activity is running, the service will run as well
Mark M.
if the activity is doing something to start or bind to the service, yes
Steve S.
Yes, this is a started service
7:35 PM
Steve S.
Then that makes things much easier
No more questions today - I had some more based on an incorrect assumption about the service lifetime
Mark M.
OK
Steve S.
Thank you so much, Mark!
Mark M.
you're welcome!
Steve S.
Have a good rest of the day!
Mark M.
you too!
Steve S.
has left the room
8:30 PM
Mark M.
turned off guest access

Saturday, June 24

 

Office Hours

People in this transcript

  • Mark Murphy
  • Steve S