11-21-2012 07:33 AM
is it possible to use Google API's in a BB10 app HTML5 app?
Solved! Go to Solution.
11-22-2012 04:11 AM
11-22-2012 06:10 AM
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.
11-22-2012 09:27 AM - edited 11-22-2012 09:28 AM
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-Sample
11-24-2012 02:32 AM - edited 11-24-2012 06:04 AM
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=g
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.