I've been working with opensocial recently, but have been having trouble using notifications.
The code I have is:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Notifications" description="" height="300">
<Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">
function sendNotification(title, body) {
var params = {};
params[opensocial.Message.Field.TITLE] = title;
params[opensocial.Message.Field.TYPE] = opensocial.Message.Type.NOTIFICATION;
var message = opensocial.newMessage(body, params);
var recipient = "VIEWER";
opensocial.requestSendMessage(recipient, message, callback);
};
function callback(data) {
if (data.hadError()) {
alert("There was a problem:" + data.getErrorCode());
} else {
alert("Ok");
}
};
sendNotification("This is a test notification", "How are you doing?");
</script>
]]>
</Content>
</Module>
When I install and run this gadget, I don't get any alerts or notifications, and I'm pretty stumped!
Any ideas?