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
Developer
Posts: 47
Registered: ‎11-11-2009
My Device: Not Specified

Can We Get Position Data from BlackBerry Maps

Just some simple questions:

 

Can we get position data from BlackBerry maps programmatically when user clicks on some point on the map?

 

I want to create an application that works like this:

 

User click on a textfield -> blackberry maps invoked -> user specifies his/her target location using map -> my app extracts the location from BlackBerry maps and do further processing.

 

 

If we cannot, are there any alternatives?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

You can add an ApplicationMenuItem for BB MAps to the ApplicaitonMenuItemRepository.

 

When this menu item is selected from BB Maps, it will pass your program the location in the Context object.

 

See the javadocs.

 

Also see this KB article:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800703/How_To_...

Trusted Contributor
Posts: 103
Registered: ‎11-07-2010
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

where this menue item will be added?

on which screen?

 

can you provide a screen shoots for it?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

The menu item is added to the Maps menu (which appears when you press the Menu key on the device).

 

When selected, the menu item will send the current location to your application, in the form of lat/lon.

 

 

Trusted Contributor
Posts: 103
Registered: ‎11-07-2010
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

i tried this but now menu items added to the maps application!!!!!!!!!!!!1

 

what does its name?

 

?

 

Trusted Contributor
Posts: 103
Registered: ‎11-07-2010
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

please again,

what will be the menue item?

 

i need this urgently

 

thanks,

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

Sorry, but I don't understand what your issue is.

 

If you followed the link provided, the menu item appears on the BB Maps application, and it is called whatever you called it in your implementation of ApplicationMenuItem.

 

 

 

Trusted Contributor
Posts: 103
Registered: ‎11-07-2010
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

i wrote this

 

ApplicationMenuItemRepository amir =
                ApplicationMenuItemRepository.getInstance();
            ApplicationDescriptor ad_startup =
                ApplicationDescriptor.currentApplicationDescriptor();
            ApplicationDescriptor ad_gui =
                new ApplicationDescriptor(ad_startup, "gui", null);
            amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_MAPS,new MapMenuItem(),ad_gui);
            
            Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments());

 

private static class MapMenuItem extends ApplicationMenuItem {

         MapMenuItem() {
            super(20);
         }

         public String toString() {
            return "My Menu Item";
         }

         public Object run(Object context) {
             MapView   mv = (MapView)context;

            if (mv != null) {

                Log.writeLine("Latitude = " + mv.getLatitude());
                Log.writeLine("Longitude = " + mv.getLongitude());
                Log.writeLine("Zoom = " + mv.getZoom());

            }
            else {
                 throw new IllegalStateException("Context is null, expected a MapView instance");
            }
            return null;
         }
    }

 

but i couldnot find any result.

 

is there is any mistakes on this with this?

Trusted Contributor
Posts: 103
Registered: ‎11-07-2010
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

no reply?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Can We Get Position Data from BlackBerry Maps

What is the exact issue? What exception are you getting?