Hey

Using OpenSocial javascript API,you can
(1)get "<static> object ADDRESSES---Addresses associated with the
person, specified as an Array of Addresses. "
(2)get "<static> object CURRENT_LOCATION---Person's current location,
specified as an Address. "

So I think It depends how contianer implement  OpenSocial JavaScript
spec.

It does works for my container&shindig now as follows,use option 2
current_location.

opensocial.Person.Field.CURRENT_LOCATION,

var location =viewer.getField
(opensocial.Person.Field.CURRENT_LOCATION);
if(location!=undefined){
      html += "opensocial.Address.Field.REGION:"+location.getField
(opensocial.Address.Field.REGION);
      html += "<br>";
      html += "opensocial.Address.Field.LOCALITY:"+location.getField
(opensocial.Address.Field.LOCALITY);
      html += "<br>";
}

And the full example as follow.
--------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="load viewr all info">
        <Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html" >
        <![CDATA[

                <script>
                        gadgets.util.registerOnLoadHandler(init);

                        function init() {
                          loadViewer();
                        }

                        function loadViewer() {
                                var req = opensocial.newDataRequest();
                                var opt_params = {};
                                opt_params
[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
                                                                                
[
                                                                                
        //NAME
                                                                                
        opensocial.Person.Field.NAME,

                                                                                
        //NICKNAME
                                                                                
        opensocial.Person.Field.NICKNAME,

                                                                                
        //GENDER
                                                                                
        opensocial.Person.Field.GENDER,

                                                                                
        //CURRENT_LOCATION
                                                                                
        opensocial.Person.Field.CURRENT_LOCATION,

                                                                                
        //EMAILS
                                                                                
        opensocial.Person.Field.EMAILS,

                                                                                
        //DATE_OF_BIRTH
                                                                                
        opensocial.Person.Field.DATE_OF_BIRTH,

                                                                                
        //IMS
                                                                                
        opensocial.Person.Field.IMS,

                                                                                
        //STATUS
                                                                                
        opensocial.Person.Field.STATUS,

                                                                                
        //RELATIONSHIP_STATUS
                                                                                
        opensocial.Person.Field.RELATIONSHIP_STATUS,
                                                                                
];

                                
req.add(req.newFetchPersonRequest('VIEWER',opt_params),
'viewer');
                                req.send(onLoadViewer);
                        }

                        function onLoadViewer(data) {
                                var viewer = data.get('viewer').getData();
                                var html = "";

                                var displayName = viewer.getDisplayName();
                                html += "viewer.getDisplayName():"+displayName;
                                html += "<br>";

                                var nickName = 
viewer.getField(opensocial.Person.Field.NICKNAME);
                                html += 
"opensocial.Person.Field.NICKNAME:"+nickName;
                                html += "<br>";

                                var id = 
viewer.getField(opensocial.Person.Field.ID);
                                html += "opensocial.Person.Field.ID:"+id;
                                html += "<br>";

                                var name = 
viewer.getField(opensocial.Person.Field.NAME);
                                html += 
"opensocial.Person.Field.NAME:"+name.getField
(opensocial.Name.Field.UNSTRUCTURED);
                                html += "<br>";

                                var gender = 
viewer.getField(opensocial.Person.Field.GENDER);
                                if(gender){
                                        html += 
"opensocial.Person.Field.GENDER:"+gender.getDisplayValue
();
                                        html += "<br>";
                                }

                                var location =viewer.getField
(opensocial.Person.Field.CURRENT_LOCATION);
                                if(location!=undefined){
                                        html += 
"opensocial.Address.Field.REGION:"+location.getField
(opensocial.Address.Field.REGION);
                                        html += "<br>";
                                        html += 
"opensocial.Address.Field.LOCALITY:"+location.getField
(opensocial.Address.Field.LOCALITY);
                                        html += "<br>";
                                }

                                var thumbnail_url = viewer.getField
(opensocial.Person.Field.THUMBNAIL_URL);
                                html += 
"opensocial.Person.Field.THUMBNAIL_URL:"+thumbnail_url;
                                html += "<br>"

                                var profile_url = viewer.getField
(opensocial.Person.Field.PROFILE_URL);
                                html += 
"opensocial.Person.Field.PROFILE_URL:"+profile_url;
                                html += "<br>"

                                //
                                //var emails = 
viewer.getField(opensocial.Person.Field.EMAILS);
                                //if(emails!=undefined){
                                //      html += "email:"+emails[0].getField
(opensocial.Email.Field.ADDRESS);
                                //      html += "<br>"
                                //}

                                //DATE_OF_BIRTH
                                var birth = viewer.getField
(opensocial.Person.Field.DATE_OF_BIRTH);
                                if(birth){
                                        html +=
"opensocial.Person.Field.DATE_OF_BIRTH:"+birth.toDateString();
                                        html += "<br>"
                                }

                                //TODO IMS not in opensocial js spec
                                var ims = 
viewer.getField(opensocial.Person.Field.IMS);
                                if(ims){
                                        html += "IM:"+ims;
                                        html += "<br>"
                                }

                                var status = 
viewer.getField(opensocial.Person.Field.STATUS);
                                if(status){
                                        html += 
"opensocial.Person.Field.STATUS:"+status;
                                        html += "<br>"
                                }

                                var relationship_status = viewer.getField
(opensocial.Person.Field.RELATIONSHIP_STATUS);
                                if(status){
                                        html +=
"opensocial.Person.Field.RELATIONSHIP_STATUS:"+relationship_status;
                                        html += "<br>"
                                }

                                document.getElementById('main').innerHTML = 
html;
                        }
                </script>

                <div id='main'>
                </div>

        ]]>
        </Content>
</Module>



James

On Feb 11, 5:00 pm, Soumya <dummy...@gmail.com> wrote:
> Hi All,
>
> Please help me to find owner's city name using opensocial API 0.7.
>
> Any kind of help will be appreciated.
>
> Thanks and regards,
>
> Soumya
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to opensocial-api@googlegroups.com
To unsubscribe from this group, send email to 
opensocial-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to