LocationManager requestLocationUpdates and timertask in android
<p>I have the following code:</p>

<pre><code>if (gps_enabled) {
        Log.e("$$$$$$$$$$$$$$",
                "GPS is enabled requestion location updates... interval value is: "
                        + interval);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                locationListenerGps);
    }
    else{
        if (network_enabled) {
            Log.e("$$$$$$$$$$$$$$",
                    "Network is enabled requestion location updates... interval value is: "
                            + interval);
            lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,
                    0, locationListenerNetwork);
        }
    }
</code></pre>

<p>with that code I can get the location(at least using the network provider! (another issue on another post))
I would like to get notifications in a regular interval say every one hour, but passing the parameter to requestLocationUpdates doesn't guarantee that the interval will be maintained (at least that my tests showned,since I expected update every minute but got a lot of updates instead of one!)
so i thought of using a timerTask and schedule it, I now have </p>

<pre><code>timer1.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            getLocation();
        }

    }, 0, 180000);// 3 minutesr...
</code></pre>

<p>where getLocation is the method that I called previously called, but when the timer calls that method then nothing happens, the logs stop at this point </p>

<pre><code>Log.e("$$$$$$$$$$$$$$",
                    "Network is enabled requestion location updates... interval value is: "
                            + interval);
</code></pre>

<p>and I never get notified about my location.
any Ideas?
thanks in advanced maxsap.</p>
