Posting into Activity Stream

1 view
Skip to first unread message

sharath

unread,
Apr 21, 2008, 9:18:41 AM4/21/08
to OpenSocial - OpenSocial Application Development
Hello,

I am using the below code to post activity

<script type="text/javascript">
function createActivity() {
var title= '';
title = 'Hey, I have added MyVideos. Come on! Join with me';
var activity_params = {};
alert(1);
activity_params[opensocial.Activity.Field.TITLE] = title;
var activity = opensocial.newActivity(activity_params);
alert(activity);
opensocial.requestCreateActivity(activity, "HIGH",
getCreateActivityResp);
}
function getCreateActivityResp(responseItem) {
console.log(responseItem);
var htmlout = '';
if(responseItem.hadError()){
//htmlout= 'has error: ' + responseItem.ErrorMessage;
alert(responseItem.ErrorMessage +'has error');
}
else{
alert('create activity good!')
}
}
createActivity();
</script>

This code posts activity for every page load, but i want to post
activity only once when the user adds the application for first time.

How to achieve it?

Thanks and regards
Sharath

Aakash Bapna

unread,
Apr 21, 2008, 1:39:53 PM4/21/08
to opensoc...@googlegroups.com
As far as i know, in orkut an activity is automatically created when user adds a app.
Otherwise this will be possible only when there is a option for onInstall, onUninstall callback urls in future OpenSocial release, for now only hi5 has this feature..

Thanks
 
~@@k@sh
http://aakash-bapna.blogspot.com





> Date: Mon, 21 Apr 2008 06:18:41 -0700
> Subject: [OpenSocial] Posting into Activity Stream
> From: shara...@gmail.com
> To: opensoc...@googlegroups.com

sharath

unread,
Apr 21, 2008, 9:23:29 PM4/21/08
to OpenSocial - OpenSocial Application Development
Hi,

Thanks for the reply.
Presently there is no activity created on install automatically in
orkut.

Regards
Sharath

On Apr 21, 10:39 pm, Aakash Bapna <aak...@live.com> wrote:
> As far as i know, in orkut an activity is automatically created when user adds a app.
> Otherwise this will be possible only when there is a option for onInstall, onUninstall callback urls in future OpenSocial release, for now only hi5 has this feature..Thanks ~@@k@shhttp://aakash-bapna.blogspot.com
>
> > Date: Mon, 21 Apr 2008 06:18:41 -0700> Subject: [OpenSocial] Posting into Activity Stream> From: sharath2...@gmail.com> To: opensoc...@googlegroups.com> > > Hello,> > I am using the below code to post activity> > <script type="text/javascript">> function createActivity() {> var title= '';> title = 'Hey, I have added MyVideos. Come on! Join with me';> var activity_params = {};> alert(1);> activity_params[opensocial.Activity.Field.TITLE] = title;> var activity = opensocial.newActivity(activity_params);> alert(activity);> opensocial.requestCreateActivity(activity, "HIGH",> getCreateActivityResp);> }> function getCreateActivityResp(responseItem) {> console.log(responseItem);> var htmlout = '';> if(responseItem.hadError()){> //htmlout= 'has error: ' + responseItem.ErrorMessage;> alert(responseItem.ErrorMessage +'has error');> }> else{> alert('create activity good!')> }> }> createActivity();> </script>> > This code posts activity for every page load, but i want to post> activity only once when the user adds the application for first time.> > How to achieve it?> > Thanks and regards> Sharath> _________________________________________________________________
>
> Get in touch in an instant. Get Windows Live Messenger now.http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_...

Rohit Ghatol (Google)

unread,
Apr 22, 2008, 1:24:42 AM4/22/08
to OpenSocial - OpenSocial Application Development
Hi Sharath,

This is an interesting concept. In order to achieve this may be you
can use app data. You could check if the field, say "installed"
exists, and if not, then do any installation tasks and set the
"installed" field.

I hope this helps.

Regards,
Rohit

sharath

unread,
Apr 23, 2008, 10:22:53 AM4/23/08
to OpenSocial - OpenSocial Application Development
Hi Rohit,

Thanks for the reply.
Is there any class defined in opensocial to check the installed field
or what is the approach?

Thanks and Regards
Sharath

On Apr 22, 10:24 am, "Rohit Ghatol (Google)"

Rohit Ghatol (Google)

unread,
Apr 30, 2008, 12:30:29 AM4/30/08
to OpenSocial - OpenSocial Application Development
Hi Sharath,
Sorry about the late response. What I really meant here was to use
PersonAppData to store a field named "installed". Check this field to
see if the application was installed, if not do installation tasks and
then set a field named "installed" in the PersonAppData.
Try out this example, this will make things lot clearer.

http://hosting.gmodules.com/ig/gadgets/file/115537651881774373169/app-install.xml

In this example, you have to replace the contents of install function
with your code of writing to the activity stream.

Regards,
Rohit

On Apr 23, 7:22 pm, sharath <sharath2...@gmail.com> wrote:
> Hi Rohit,
>
> Thanks for the reply.
> Is there any class defined in opensocial to check the installed field
> or what is the approach?
>
> Thanks and Regards
> Sharath
>
> On Apr 22, 10:24 am, "Rohit Ghatol (Google)"
>
> <api_rohitgha...@google.com> wrote:
> > Hi Sharath,
>
> > This is an interesting concept. In order to achieve this may be you
> > can use app data. You could check if the field, say "installed"
> > exists, and if not, then do any installation tasks and set the
> > "installed" field.
>
> > I hope this helps.
>
> > Regards,
> > Rohit
>
> > On Apr 22, 6:23 am, sharath <sharath2...@gmail.com> wrote:
>
> > > Hi,
>
> > > Thanks for the reply.
> > > Presently there is no activity created oninstallautomatically in

sharath

unread,
May 4, 2008, 11:29:22 AM5/4/08
to OpenSocial - OpenSocial Application Development
Hi Rohit,

Thanks for your reply, Its working well.
Another query, I need to write into activity stream once a day when
specific activity is performed.
I have got the code to write into activity stream, need help to limit
it once per day or week something like this.

Regards
Sharath

On Apr 30, 9:30 am, "Rohit Ghatol (Google)"
<api_rohitgha...@google.com> wrote:
> HiSharath,
> Sorry about the late response. What I really meant here was to use
> PersonAppData to store a field named "installed". Check this field to
> see if the application was installed, if not do installation tasks and
> then set a field named "installed" in the PersonAppData.
> Try out this example, this will make things lot clearer.
>
> http://hosting.gmodules.com/ig/gadgets/file/115537651881774373169/app...
>
> In this example, you have to replace the contents of install function
> with your code of writing to the activity stream.
>
> Regards,
> Rohit
>
> On Apr 23, 7:22 pm,sharath<sharath2...@gmail.com> wrote:
>
> > Hi Rohit,
>
> > Thanks for the reply.
> > Is there any class defined in opensocial to check the installed field
> > or what is the approach?
>
> > Thanks and Regards
> >Sharath
>
> > On Apr 22, 10:24 am, "Rohit Ghatol (Google)"
>
> > <api_rohitgha...@google.com> wrote:
> > > HiSharath,
>
> > > This is an interesting concept. In order to achieve this may be you
> > > can use app data. You could check if the field, say "installed"
> > > exists, and if not, then do any installation tasks and set the
> > > "installed" field.
>
> > > I hope this helps.
>
> > > Regards,
> > > Rohit
>

Aakash Bapna

unread,
May 4, 2008, 6:58:15 PM5/4/08
to opensoc...@googlegroups.com
Hi Sharath,
 
they are working on posting only the most recent activity through the app in a day..
right now there is no limit neither in sandbox nor main orkut,
> Date: Sun, 4 May 2008 08:29:22 -0700
> Subject: [OpenSocial] Re: Posting into Activity Stream
> From: shara...@gmail.com
> To: opensoc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages