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: 39
Registered: ‎02-07-2012
My Device: Blackberry curve 8520 // Blackberry playbook 64GB
My Carrier: Vodafone

Google feed API + bbui.js

hi, im looking for a way to implememt the google feed api with bbui.js . when i tried to add this code, it always gives me an error. someone found a way to succesfully add this?

Developer
Posts: 322
Registered: ‎08-06-2012
My Device: Dev Alpha / Playbook / Curve 9300

Re: Google feed API + bbui.js

Can you supply the code?

 

Also, not sure if it has changed but you cannot put INLINE javascript in a bbui project.  Your code needs to sit outside the HTML file.  You need to link to / reference it.

 

What is the error you get btw?

If it helped you, click like. Smiley Happy
Highlighted
Developer
Posts: 39
Registered: ‎02-07-2012
My Device: Blackberry curve 8520 // Blackberry playbook 64GB
My Carrier: Vodafone

Re: Google feed API + bbui.js

the Google Feed.js

function rssfeedsetup(){
var feedpointer=new google.feeds.Feed(feedurl)
feedpointer.setNumEntries(feedlimit) 
feedpointer.load(displayfeed) 
}

function displayfeed(result){
if (!result.error){
var thefeeds=result.feed.entries
for (var i=0; i<thefeeds.length; i++)
rssoutput+="<a href='" + thefeeds[i].link + "'>" + thefeeds[i].title + "</a> " + thefeeds[i].content
rssoutput+="</ul>"
feedcontainer.innerHTML=rssoutput
}
else
alert("Error fetching feeds!")
}
var feedcontainer=document.getElementById("feed")
var feedurl="http://feeds.feedburner.com/Limet?format=xml"
var feedlimit=10
var rssoutput="<h2>Rss</h2><ul>"

 

and the HTML file (will be used on top of the index.htm via bb.pushScreen() )

 

<div data-bb-type="screen" data-bb-effect="slide-left">
<div data-bb-type="round-panel"> 
<div id="feed"></div>
<button onclick="rssfeedsetup()">CLICK</button>
</script>
</div>
<div data-bb-type="action-bar" data-bb-back-caption="Back"></div>
</div>

 

 

 

the error: Uncaught TypeError: Cannot read property 'Feed' of undefined

 

hope you guys can help out

 

Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: Google feed API + bbui.js

You problem is not related to bbUI or webworks at all, you're just missing some important aspects of google feed.

make sure you do the basic initialization before attempting to read any feed.

examples here: https://developers.google.com/feed/v1/devguide

Nuno