February 26, 2009

Create Activity feature added to the library


Updated Today (21 minutes ago)by swswsw
Labels:example
The library is capable of doing requestCreateActivity() now.

Example of requestCreateActivity

        private function createActivity():void {
               
var params:Object = {};
               
params[com.nextgenapp.opensocial.activity.Field.TITLE] = "test activitiy title";
               
var activity:Activity = container.newActivity(params);
               
                container
.requestCreateActivity(activity, com.nextgenapp.opensocial.CreateActivityPriority.HIGH, createActivityCallback);
       
}
       
private function createActivityCallback(respItem:ResponseItem):void
       
{
               
// note: requestSendMessage() returns ResponseItem, not DataResponse.  
                trace
("createActivityCallback");
               
Alert.show("createActivityCallback.  haderror=" + respItem.hadError());
               
if (respItem.hadError()) {
                       
// get the response item
                       
Alert.show("createActivityCallback.  errorCode=" + respItem.getErrorCode() + ".  errorMessage=" + respItem.getErrorMessage());
                       
                       
if ("forbidden" == respItem.getErrorCode()) {
                               
Alert.show("user denied permission.  you have to ask user for permission.");
                       
}
               
}
       
}

A full sample code can be found here: http://opensocial-tutorial-trial.googlecode.com/svn/trunk/os-as-lib-081-test/src/ActivityExampleOrkut.mxml

1 comment:

  1. Hi,

    As the API use javascript and application need to run inside an opensocial container, how to you manage the remote debugging using Flex Builder? Can you explain us?

    ReplyDelete