I am writing an app that receives GPS data through SMS which is intercepted using a Listening thread that is running at startup of the phone. This listener will notify the user with an icon on the home screen where the user will then open up the user interface portion. Now while the map is already up and an SMS is received, the map should be updated with the new point.
I have tried everything to do the following:
in the MainScreen class:
void updateDisplay()
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
addPoint();
}
});
}
In the Listening Thread, I just call screen.updateDisplay().
Is this the right method to update the map because currently this doesn't work so can you suggest a better way to go about what we want to achieve?
Thanks.
it seems you have 2 applications, one that is started at startup to listen to the sms, and the other one, the UI portion that is run by the user.
You want the other application(the listener app to update something on UI app.) You cannot simply do that by UiApplication.getUiApplication().invokeLater(new Runnable(), because your listenerapplication is not a UI app, even if it is, the method will return the UI thread of the listener app, not the user UI app. because they are 2 separate apps.
What you need to do is to pass the point or lat/long as an object to the other application. i.e you need to intercommunicate between the apps.
The Blackberry runtime store does this perfectly. You put an object in the runtime store from the Listener app, then retrieve it from the runtime store with the UI app. See the rim java forum for a lot of examples using the runtime store.
This seems to be a bit too BlackBerry API specific issue, not specific to our mapping tookit. I'm not sure if we could assist you here.
/JaakL