I couldn\'t find any examples of how to send messages between an activity and a service, and I have spent far too many hours figuring this out. Here is an example project fo
Note: You don't need to check if your service is running, CheckIfServiceIsRunning()
, because bindService()
will start it if it isn't running.
Also: if you rotate the phone you don't want it to bindService()
again, because onCreate()
will be called again. Be sure to define onConfigurationChanged()
to prevent this.