I have a strange problem in my application. I'm not sure whether it's caused by the code in the retrieving location or some strange out of memory problem.
So, I've Location class, which has a getLocation() method, it consists pretty much of this:
location = lp.getLocation(-1);
coordinates = location.getQualifiedCoordinates();
lat = coordinates.getLatitude();
alt = coordinates.getAltitude();
I create the location Object in the initialization, and call the object's getLocation() method in a thread every 2 seconds. And then I retrieve lat / lng / time from the object.
Problem is, after I've received around 250(+-10) locations, I suddenly can't get more location. It's not related to the time (I've tried different delays in the thread)...
I'm also saving a the location+timestamp into a recordstore ( I first had a ByteArrayOutputStream as a buffer which I was just filling with the location strings and then when shutting down the software, writing it on a text file)
So from what I can think of, either the problem is in the location class or somehow some internal memory is getting full (there's no exceptions caused, the gps locations just suddenly stop updating, and I can still use the menu to read the recordstore and save it on a file).
It's most likely some newbieish mistake I have as this is my first time using location api.
Ps. In case it's phone related: I have Nokia N95
I've simplified the program, and now it's basically, the main class and a location class.
Main class implements runnable and from there I call the location classes getlocation every 2 seconds, to update the values. I don't even save them anywhere, I just display them on screen, and it still 'freezes' (same like before, I can operate menu and exit it normally, it just stops receiving the location updates)
Pss. I've tried this on Nokia N78, and it seems to work on that, atleast I managed to have the program running for like 10 minutes and it was still receiving fixes.
Psss. Ok, it seems like it does NOT work on nokia N78... I've now tried with 3 different phones, N95, N78 and another nokia... all of them seem to crash at 250 locations. N95 doesn't really crash, but N78 and the 3rd get into a total deadlock... and have to be forcefully booted.
This does not happen on emulator.
Message was edited by: mtj