I am hoping someone can point me in the right direction here. I'm
writing some sample gadget apps using OpenSocial .9, specifically
dealing with writing/reading app data.
I'm currently following a tutorial that writes a simple key/value to
the app data and then tries to retrieve it. See code below.
When I install my gadget on my iGoogle page, and set my prefs to
"Allow this gadget to know who I am...", then I am able to write and
read from the app data.
However on my Google Sites page, when I install this gadget, I don't
see such preferences. So when I try and read the data, I get the
error "The currently logged in user and/or the gadget requesting data,
does not have access to person data."
Is there a way I can still access this data from my gadget on a google
site?
My use case is simple... I'd like to add my gadget to my google site
page, interactively set a value from the running gadget, and have all
users that see my site have the same data presented. Something like:
"Times I sneezed today" with an "Add 1" button. Every time I press
the button, a counter is incremented, and displayed. Everyone who
comes to my site can see that counter.
function osSave()
{
var req = opensocial.newDataRequest();
var fetchPersonRequest =
req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER);
req.add(fetchPersonRequest, "viewer");
req.send(handleRequestMe);
}
function handleRequestMe(data)
{
var viewer = data.get("viewer");
if(viewer.hadError())
{
alert('Error:' + viewer.getErrorMessage());
return;
}
else
{
alert('No error...good job.');
}
}
Thanks for reading. Any tips or topics to pursue would be
appreciated.
--
You received this message because you are subscribed to the Google Groups
"OpenSocial Application Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/opensocial-api?hl=en.