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

Web and WebWorks Development

Reply
New Contributor
maxspeed
Posts: 4
Registered: ‎12-13-2012
My Device: BB10 Dev Alpha
My Carrier: AT&T

Webworks BB10 - Invoke Maps w/ directions

[ Edited ]

I am trying to convert my BB7 Webworks app to BB10. I think I understand the Invoke framework ok but I cannot figure out how to invoke the default the native Maps App AND set to go to a certain direction from the current location(Bounded invoke). The documentation on this is incomplete.

 

Here is how I did it in BB7 Webworks. Can someone help me understand where I need to make the changes for BB10 Webworks? 

 

	invokeNativeMapApp: function(gps){
		var directionsMapsAppArgs="<lbs clear='ALL'><getRoute><location lon='"
                                        + Math.round(gps.longitude*100000)+"' lat='"+Math.round(gps.latitude*100000)+"' "
         				+"label='Me' description='My Location' /> "
       					+ "<location lon='"+ Math.round(myDestination.longitude*100000) +"' lat='"
                                        + Math.round(myDestination.latitude*100000)+"' "
         				+" label='My Destination' description='My Destination' /></getRoute></lbs>";

		var mapsAppArgs = "<lbs clear='ALL' id='My Destination'><location lon='"
                                        +Math.round(myDestination.longitude*100000)+"' lat='"
                                        +Math.round(myDestination.latitude*100000)+"' "
         				+" label='My Destination' description='My Destination' /></lbs>";
        console.log(mapsAppArgs);
		var invokeArgs= new blackberry.invoke.MapsArguments(mapsAppArgs);
		blackberry.invoke.invoke(blackberry.invoke.APP_MAPS, invokeArgs)
	},

 

Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Webworks BB10 - Invoke Maps w/ directions

You can do things a couple different ways. Here is a quick overviews of the MAPS application that you are trying to use:

 

MAPS 

target Id: "com.tcs.maps"

Mime types it accepts:

application/vnd.blackberry.string.address

application/vnd.google-earth.kml+xml

application/vnd.rim.map.action-v1

application/vnd.google-earth.kmz

 

Actions:

bb.action.OPEN 
bb.action.NAVIGATETO 
bb.action.MAP 
bb.action.ADDTOMYPLACES

 

 

How I invoked it with a direction:

<script>

blackberry.invoke.invoke({

    action :"bb.action.NAVIGATETO",

    type: "application/vnd.blackberry.string.address",

    data: "An addrtess string that it will try and parse" }

);

</script>

 

 

Hope that helps!

@erikjohnzon
erjohnson@blackberry.com
Please use plain text.
New Contributor
maxspeed
Posts: 4
Registered: ‎12-13-2012
My Device: BB10 Dev Alpha
My Carrier: AT&T

Re: Webworks BB10 - Invoke Maps w/ directions

[ Edited ]

The example below uses a postal mailing address,  since would like to send data in latitude/longitude - what is the correct Mime "type" property and how should I format the "data" property in the invoke parameter?

 

In other words, where can i get code samples or docs on to use latitude/longitude:

 

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Webworks BB10 - Invoke Maps w/ directions

OKay it took some digging but I managed to get it working for me. It seems to work quite well :smileyhappy:. So give this a shot, should be pretty copy and paste for you I hope. If I made any pasting errors I apologize. This is a sample of the rim mime type:application/vnd.rim.map.action-v1 that accepts JSON.

 

<code>

 

blackberry.invoke.invoke({

action :"bb.action.OPEN",

type: "application/vnd.rim.map.action-v1",

data: JSON.stringify({

"view_mode" :"nav",

"center" : { "latitude" : 43.46426, "longitude" : -80.52041, "heading" : 180, "zoom" : 4 }, "nav_start" : {

"properties" : {

"name" : "Display Name",

"description" : "Description",

"address" : "Waterloo, Ontario"

},

"latitude" : 43.46426,

"longitude" : -80.52041

},

"nav_end" : {

"properties" : {

"name" : "Display Name",

"description" : "Description",

"address" : "Ottawa, Ontario"

},

"latitude" : 45.000,

"longitude" : -75.0000

},

"nav_options" : {

"nav_mode" : "fastest",

"avoid_highways" : false,

"avoid_tolls" : false,

"transport_mode" : "car"

}})

});

 

</code>

@erikjohnzon
erjohnson@blackberry.com
Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Webworks BB10 - Invoke Maps w/ directions

To answer your questions on the docs/samples. I'll open an issue on the Samples github repo and see if we can get someone to take it on :smileyhappy:.

@erikjohnzon
erjohnson@blackberry.com
Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Webworks BB10 - Invoke Maps w/ directions

I opened the following issue: https://github.com/blackberry/BB10-WebWorks-Samples/issues/55

@erikjohnzon
erjohnson@blackberry.com
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Webworks BB10 - Invoke Maps w/ directions

Hi Erik

 

will it be possible to add support for Maps service directly into an app, eg. to show a map? At this time I'm using an online maps provider like google maps API or OSM, but it would be really great to use offline maps inside an app.

 

I asked something like this in the past here too: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/BB10-BlackBerry-Maps-Service-ava...

 

Something we will see in the future?


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
BlackBerry Development Advisor (Retired)
erikjohnzon
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Webworks BB10 - Invoke Maps w/ directions

I'm not totally sure, the official documentation will be released soon that shows how to invoke key native applications that are not currently included on the dev alpha. We will both have to wait on see on that one.
@erikjohnzon
erjohnson@blackberry.com
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Webworks BB10 - Invoke Maps w/ directions

Hi Erik,

 

THX for your answer. Hope to see something soon since we are working on the 10k app and we would like to use offline maps instead of using online maps for it. Would be great to see an API for it in BB10!!


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
Contributor
mserina
Posts: 44
Registered: ‎11-12-2012
My Device: BB 10 Dev Apha
My Carrier: -

Re: Webworks BB10 - Invoke Maps w/ directions

Hi guys, I'm just writing here because this is the best post I ever found about maps till now..

My problem is that I need to open the Maps application and set the position to certain, provided coordinates..the given example is great but it always trigger the navigation..I would simply like to show the location as well as it happens when a user just write an address and the application just shows the POI corrseponding to that address..

 

do you think it is currently possible??

 

Thanks a lot in advance

 

-marco

Please use plain text.