Hello all, I have the following 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);
}
}
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
timer1.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
getLocation();
}
}, 0, 180000);// 3 minutesr...
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
Log.e("$$$$$$$$$$$$$$",
"Network is enabled requestion location updates... interval value is: "
+ interval);
and I never get notified about my location. any Ideas? thanks in advanced maxsap.