Are you still seeing this problem? It seems to be working for me. If
so, can you link me to your profile with the application installed?
Keep in mind that VIEWER information will always be null if the
current user doesn't have the app installed -- this is normal. OWNER
information should always be available, however, so please let me know
if this is still an issue by linking to your profile.
After peeking through your code, my only observation is that you can
shorten your initial data request slightly. Your current
implementation shouldn't be causing any errors, but for future
reference, you can shorten your request to the following:
function getData() {
var req = opensocial.newDataRequest();
var opt_params = {};
opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.PROFILE_URL];
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,
opt_params), "viewer");
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER,
opt_params), "owner");
req.send(onLoadFriends);
};
function onLoadFriends(dataResponse) {
var viewer = dataResponse.get("viewer").getData();
var owner = dataResponse.get("owner").getData();
if (viewer != null) {
idviewer = viewer.getId();
}
idowner = owner.getId();
var profile_url =
owner.getField(opensocial.Person.Field.PROFILE_URL);
...
};
Notice that I only request the OWNER once in the getData() function,
not twice. I don't have to explicitly ask for the ID since it's
returned by default for users with the app installed -- just call the
getId method of the returned opensocial.Person objects.
- Jason