Making a task every x time
<p>I use the attached code to send to my db every 5 min some information, some of the information  is timestamp.
When I look in my db I see records with 6 minute diffrence and even 7, how come? Some told me that my task takes too long.</p>

<p>Anyway my question is how I can force my code to send the info the to the db every 5 min.</p>

<p>*Important thing I have to say that I have a condition on the task which means that sometimes it won't do a thing so the diffrence between the records should be multiples of five.</p>

<pre><code>this.timer.schedule(new Send(), new Date(), TEN_SECONDS*6*5);

class Send extends TimerTask
{
    public void run()
    {
        if(location!=null)
        {
            if (mGeocoderAvailable) 
                address = reverseGeocode(LocationService.this.location);
            if(address != "" &amp;&amp; !address.equals(lastAddress))
            {
                lastAddress = address;
                new SendLocation(LocationService.this.id,address);
            }
        }
    }
}
</code></pre>

<p>The SendLocation body is like this:</p>

<pre><code>public SendLocation(int id,String address)
{
    // taking care the parameters
    this.start();
}
public void run() 
{ 
    //connect to db
    //send location to db
    this.destroy();
}
</code></pre>
