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
Developer
Posts: 78
Registered: ‎01-14-2013
My Device: Games
My Carrier: Not yet
Accepted Solution

[Open Maps]

Dear friends,

Can we open MAPS application, and focus by "Postalcode"?

I referred to "http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Webworks-BB10-Invoke-Maps-w-dire... and I can open, but I don't know how to focus maps to my "postalcode".

Thank you so much.

Dennis Ritchie.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: [Open Maps]

Based on the sample here:
http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Webworks-BB10-Invoke-Maps-w-dire...

My best guess would be to supply the postal code into the "address" value of the target start/end location. Note that in the sample the geolocation coordinates are hard-coded, and you could use the geolocation API / omit (for the end point) the values.

Alternatively, you could leverage a postal-code lookup service to convert to a city, country, etc. and provide that in the address field.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: [Open Maps]

[ Edited ]

This turned out to be easier than I though. To open BlackBerry Maps / navigate to a Postal Code, the following worked for me.

 

config.xml

 

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0.0" id="com.oros.invokemaps">

	<name>Invoke Maps</name>
	<author>Erik Oros</author>

	<content src="index.html"/> 

	<feature id="blackberry.invoke" />
</widget>

 

index.html

 

<!DOCTYPE html>
<html>
	<head>
		<title>Invoke Maps</title>
	</head>
	<body>
		<div>Hello World!</div>
		
		<script type="text/javascript" src="local:///chrome/webworks.js"></script>
		<script type="text/javascript">
			/*global window, document, blackberry, console, alert */
			'use strict';

			window.addEventListener('load', function () {
				document.addEventListener('webworksready', function () {
					alert('Halt!');

					blackberry.invoke.invoke({
						'action' : 'bb.action.NAVIGATETO',
						'type': 'application/vnd.blackberry.string.address',
						'data': 'N2J2K7'
					});
				}, false);
			}, false);
		</script>
	</body>
</html>

Note that the alert('Halt!') is there just to pause during startup so I have time to connect Web Inspector.

 

If you want to simply open the Maps application to the Postal Code, you can replace bb.action.NAVIGATETO with bb.action.OPEN


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.