Hi all,
I' currently playing around with the location API on my N95. I tried to get the location by using LocationProvider.getLocation(), which works fine. However, without changing the settings for the MIDlet it asks the user's permission everytime, which I'd rather avoid.
I tried to use the callback method (setLocationListener and locationUpdated), but locationUpdated() is only called once on my phone. On the emulator it works fine.
Here's the code:
What could be the reason for it? I'm catching every exception in locationUpdated() and the only things I'm doing in there is to read out the coordinates and start a thread to handle them. Anything I missed?Code:public void locationUpdated(LocationProvider lp, Location loc) { try { Coordinates coords = loc.getQualifiedCoordinates(); if (coords != null) { double x = coords.getLongitude(); double y = coords.getLatitude(); // Start thread for handling the new coordinates // (...) } else { // reset the local coordinates // (...) } } catch (Exception e) { // handle the exception // (...) } }
Any hints would be appreciated, thanks!

Reply With Quote


