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
Contributor
samdonly1
Posts: 28
Registered: ‎11-17-2012
My Device: -
My Carrier: aircel
Accepted Solution

Google API's in BB10 OS app

is it possible to use Google API's in a BB10 app HTML5 app?

Please use plain text.
Contributor
samdonly1
Posts: 28
Registered: ‎11-17-2012
My Device: -
My Carrier: aircel

Re: Google API's in BB10 OS app

I checked it using Ripple emulator, the map is not showing up there
Please use plain text.
Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: Google API's in BB10 OS app

Do you have the <access> element in place to allow it to load the map tiles? Were there any errors that showed up in Web Inspector?

 

I was tesitng an app for someone else last night that used the Google Maps API on BB10 with no problems.

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Please use plain text.
BlackBerry Development Advisor
chadtatro
Posts: 619
Registered: ‎10-01-2009
My Device: Z10
My Carrier: Bell

Re: Google API's in BB10 OS app

[ Edited ]

Hi there,

 

I have a sample app that just made it's way to GitHub that I think will help you out a lot here.  It shows how to add maps (Google, Bing, OpenLayers, and Leaflet) in to your WebWorks apps for BB10.

 

There will be some more information in our blogs in the near future, but you're free to check-out the sample.

 

https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/Maps

 

Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro
Please use plain text.
Contributor
marcderosa
Posts: 12
Registered: ‎02-17-2012
My Device: developer
My Carrier: developer

Re: Google API's in BB10 OS app

[ Edited ]

I dont know if you got a suitable answer to this question. I see a couple "works / doesnt work for me"s and one "here's some code figure it out".  I think the complete answer is that it depends on what (of many possible Google) API's you are using.

* In general for any API api that you access via the web, you will want add an access element at the first level of your config.xml file. Something like

<widget..>

   ...

   <access uri="https://api.ofinterest.com" subdomains="true"></access>

  ...

</widget>

modified for your specific API will be sufficient. That elemnt will then allow xhr requests to the specified domain. Note, that for BB10 webworks apps an access element like

<access uri="*"></access>

will not allow xhr access to any domain. In the past this format opened up xhr access to all sites, but no longer in BB10.

* In particular, if you are using the Google Maps API, which people are assuming. Then you should add a 

<access uri="*" subdomains="true"></access> element to your config file.

This allows the framework to white list the script tag

<script src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=true" type="text/javascript"></script>

which is probably in the header of your index.html file. And it further allows the framework to white list scripts files that google maps will dynamicly add to the header of the page at runtime. Since you dont know what scripts google maps will had to the header (they vary with api version and where you are in the world). The best your app can do here is add a * and white list anything that google might decide to stick there.

 

Other than that if you are working in the alpha simulator for a BB10 webworkds application, you should be able to access / use  google maps or other api's as described above. If you are using the Ripple thingy then I really cant vouch other than saying "who knows". I my experience Ripple has so many things wrong with it that I'm mistified as to how it justifies it's continued existance.

 

Please use plain text.
Contributor
_shivam
Posts: 31
Registered: ‎08-25-2012
My Device: Torch 9800
My Carrier: none

Re: Google API's in BB10 OS app

It will not work in ripple . check it in simulator or real device than it will show you map.

Please use plain text.