title: How to listen for messages with Nearby API Messages in a started service?
body: <p>I am developing an Android application with Google's Nearby API Messages and I was able to succesfully exchange messages between users by following this tutorial <a href="https://developers.google.com/nearby/messages/overview" rel="nofollow">https://developers.google.com/nearby/messages/overview</a></p>
  
  <p>As it is now, the application needs to be actively started by the user to start listening for messages, so I wanted to make it listen for messages from a started service which would run at boot. </p>
  
  <p>This is where it gets diffcult, because:</p>
  
  <ol>
  <li>I need my <code>GoogleApiClient</code> and <code>MessageListener</code> objects to be initialized and well (from what I gathered it is not ok for the service to just return <code>START_STICKY</code> from <code>onStartCommand()</code>since it only needs to run the <code>MessageListener.onFound()</code> method when triggered and not continuously execute code)</li>
  <li>The <code>ErrorCheckingCallback</code> class implemented in the tutorial needs a reference to an activity to work properly</li>
  </ol>
  
  <p>I spent a whole day on this and I am totally lost.
  Can anyone help?
  Thank you in advance.</p>