Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
lewisou
Posts: 5
Registered: ‎04-10-2012
My Device: Black Berry Curve

Show current location on the blackberry map

Here's the frustrating problem.

 

As you know, we can use net.rim.device.api.lbs.maps.ui.RichMapField in blackberry api to integrate the map feature into our mobile application.

 

So I use it in my application. The RichMapField works fine, as I can see streets and roads, I just can't see where i am in the map - There should be a green/blue dot that represents where I am. And the GPS icon at the top left corner shouldn't have a red cross on it.

 

The GPS icon with a red cross on it means no GPS signals.

 

But I am pretty sure I got the GPS signals as my current location showed up on the official Blackberry Map App (Got a green dot that represents where I am and the GPS icon on the left top corner of the screen does not have the red cross).

 

And by the way, in official Blackberry Map App, everything works good (there's a green dot that represents where I am on the map and no red cross on the GPS icon at the left top corner of the screen).

 

The question is: How to make the GPS active in RichMapField and show my current location as a green dot on the map just like how the official Blackberry Map App does when I use the RichMapField in my app?

 

Below is more information: I have tried using BlackBerryLocationProvider to fetch GPS data. and it works. but that does not remove the red cross from the GPS icon on the RichMapField and the green dot (current location) does not show up. I just can change the center of the map with returned lat/longi

 

action.setCentre(newMapPoint(location.getQualifiedCoordinates().getLatitude(),
                              location
.getQualifiedCoordinates().getLongitude()));

Do I need to add a special location listener to BlackBerryLocationProvider?

 

 

Contributor
Pougnet
Posts: 11
Registered: ‎10-14-2012
My Device: Developer

Re: Show current location on the blackberry map

If anyone else on here knows otherwise, feel free to correct me.

 

But, I don't think that you can do that using RichMapField.

New Contributor
lewisou
Posts: 5
Registered: ‎04-10-2012
My Device: Black Berry Curve

Re: Show current location on the blackberry map

That's interesting, as there's a GPS icon on RichMapField, so the icon is just an icon, that doesn't mean anything?

It seems the API was not fully developed before that was released to the public.

New Contributor
lewisou
Posts: 5
Registered: ‎04-10-2012
My Device: Black Berry Curve

Re: Show current location on the blackberry map

[ Edited ]

Thanks for reply.

I went through the three links that you attached, but they did not help.

 

Let me clear the question.

1. I don't have any problem with getting GPS data. even I can center the map with returned gps data (lat & long)

2. I don't have any problem with showing the map with MapField/RichMapField. I can see the streets and the roads in the map.

 

The problem is: I can't update the map respectively with returned GPS data. so after updating the map, I don't want to see the GPS icon with a red cross at the left top corner of the screen and I need a blue dot that represents where I am (the current location) and keeps moving when I moved.

 

In my mind the solution should be something like:

 

RichMapField map = MapFactory.getInstance().generateRichMapField();

LocationProvider lp = (BlackBerryLocationProvider)LocationProvider.getInstance(myBlackBerryCriteria);

lp.setLocationListener(map.getLocationListener(),  5, -1, -1);

 

Basically, map.getLocationListener() is all I want as only MapField knows itself well.

 

Best regards,

Lewis