Hello.
I'm developing in JDE 4.7, and I follow the tutorials to get the map updated with the GPS movement, but it does not move at all. It seems the LocationAPIProvider does not work.
Since the App defines a javax.microedition.location.LocationListener to get location notification for other parts of the app, it was suggested to me that the listeners get in conflict.
So, I tried creating my own LocationSource (UserLocationSource) and whenever I get a location update, I do:
WgsPoint here = new WgsPoint( locationData.getQualifiedCoordinates().getLongitude(),
locationData.getQualifiedCoordinates().getLatitude());
setLocation(here);
And setLocations does:
if (locationMarker != null) {
locationMarker.setLocation(location);
}
I do the normal:
marker = new NutiteqLocationMarker(
new PlaceIcon(gpsPresentImage, 16, 16),
new PlaceIcon(gpsConnectionLost, 16,16),
1000, true);
dataSource.setLocationMarker(marker);
map.setLocationSource(dataSource);
And and sent the emulator to simulate GPS movement. It moves! But after 4 or 5 seconds I get:
IllegalThreadStateException in TaskWorker with a null detail.
Have you seen this? Any other way to make the Map follow the GPS?
Thanks!
William Martinez.
Yes, your conclusion seems to be correct. There is shared thread for tasks, so currenly you cannot have several map components in the same time.
Not multiple mapComponents........
I have list of locations..
if i click one location map screen showing..
Am giving back to list page..
selecting next location means it showing
IllegalThreadSafeException
I guess you should use one MapComponent and use methods to move center location of it when list state changes. Maybe your code tries to make new MapComponent with each new map screen.
Update:
It turns out that it has nothing to do with the datasource.
The exception is thrown at
Line 97 of com.nutiteq.task.TasksRunnerImplcause by BasicMapComponent.startMapping() at line 309.
I have two screens, each has one Map component. I do startMapping() on each. Whenever I do this, the error is shown. It seems although I have two instances of map, they share the same thread at Taskrunner, and thus whenever one is running and the other tries to run, I got the thread exception.
That means I cannot have two maps running at the same time.
William.