this is what i use for non iframe apps
function init() {
var os = opensocial.Container.get();
dataReqObj = os.newDataRequest();
var viewerReq = os.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER);
dataReqObj.add(viewerReq);
dataReqObj.send(handleRequestMe); //Send request for viewer data
}
function handleRequestMe(data) {
//var viewer = data.get("viewer");
console.log('handle req me');
if (data.hadError()) { //Handle error using viewer.getError()...
document.getElementById('output').innerHTML = strTxt+"<br>You do not currently have this app installed. Please click the <b style >Add this app link</b> above or follow <a href='http://www.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=<app friend ID>' target='_parent'>this link</a> and click on add app.";
return;
} //No error. Do something with viewer.getData()...
loadpage(data); //this is a function that loads my data.
}
if you are using Iframes it real easy here is sample in PHP
if( isset($_GET['installState']) && intval($_GET['installState']) > 0 ){
//do something
} else{
// prompt user to add app
}
note: installState values: 0 = uninstalle, 1 = new install, 2 installed
If myspace could combine all their stuff and make same data available for all the APIs, it might not be such a pain to develop, instead of focusing on a half donkey implementation of open social which is still in beta (according to the Google opensocial site).