How to create synchronous function, working in background
<p>I have one function which is synchronously checking whether some condition is volated in the background. If violation is determined, send / create message to the user. How can I do this in Android?</p>

<p>My function's name:</p>

<pre><code>      boolean isViolated () 
</code></pre>

<p>My wish:</p>

<pre><code>      if ( isViolated () ) 
                   createMessage () 
</code></pre>
