Hi, 
My Gadget should check if the google user is logged in or not. If the user 
is logged in, reference a link that retrieves Google Contact Addresses(read 
access only). 
 
1. Is there any Gadget API to know whether user is logged in ot not? I was 
able to find OpenSocial API but it generates additional pop up window on 
google load, which I want to avoid.
 
2. I tried to retrieve google contacts(should include all contact addresses 
from contact lists, MyContacts, Other Contacts etc) from 
google gadget(javascript client). 
I modified the OAUTH sample gadget provided in the documentation: 
http://code.google.com/apis/gadgets/docs/oauth.html#sample

Here is my code snippet that modified to retrieve the postalAddress: 

  for(var i = 0; i < list.length; i++) { 
        entry = list[i]; 
        var divElement = document.createElement('div'); 
        divElement.setAttribute('class', 'name'); 
        var valueNode = document.createTextNode(entry.gd 
$postalAddress[0].$t); 
        divElement.appendChild(nameNode); 
        divElement.appendChild(valueNode); 
document.getElementById("main").appendChild(divElement);        } 
The above code snippet only returns address from Contact List but not for 
MyContacts or Other Contacts.  Please suggest how to retrieve 
these information. 
3. By using above approach, I am unable to retrieve the city, state, postal 
code from the postalAddress object.
 
4. Hence, I have gone through Alternative Approach by using Javascript 
library from this below documenation to retrieve formatted/parsed data: 
http://code.google.com/apis/gdata/articles/gdata_gadgets.html#OAuthProxy
 
Here is my code snippet which is failing with "*result.feed is undefined*" 
from firefox error console:
 
 
function getMyContacts() {  var contactsFeedUri = 
'https://www.google.com/m8/feeds/contacts/default/full?v=3.0&alt=json'; var 
query = new google.gdata.contacts.ContactQuery(contactsFeedUri); 
mycontacts.getContactFeed(query, handleContactsFeed, handleError); } 

var handleContactsFeed = function(result) { var entries = 
result.feed.entry; var contact = new contactEntry(entries[0]); var address 
= {}; address['fname'] = contact.getFirstName(); address['lname'] = 
contact.getLastName() + (contact.getAdditionalName() != '' ? ' ' + 
contact.getAdditionalName() : ''); address['address'] = 
contact.getStreet(); address['city'] = contact.getCity(); 
address['country'] = contact.getCountry(); address['zip'] = 
contact.getPostcode(); address['phone'] = contact.getPhone(); 
address['mail'] = contact.getEmail(); address['organization'] = 
contact.getOrganization(); address['birthday'] = contact.getBirthday(); 
address['event'] = contact.getEvent(); } 

Please suggest which approach is secure to use without using OpenSocial 
API's.

Thanks in advance!!!. Appreciate if anyone responds asap.

 

 

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to