2011-12-29 4 views
0

android에서 새로운 API를 사용하여 Google 캘린더에 액세스하는 방법은 무엇입니까?Google api를 사용하여 Google 캘린더에 액세스

CalendarService myService = new CalendarService("CalendarService"); 
myService.setUserCredentials("[email protected]", "yourPassword"); 
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full"); 
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class); 
Log.d(TAG,"Your calendars:"); 
for (int i = 0; i < resultFeed.getEntries().size(); i++) { 
    CalendarEntry entry = resultFeed.getEntries().get(i); 
    Log.d(TAG,entry.getTitle().getPlainText()); 
} 

하지만 때문에 SAX 예외로, 안드로이드에 같은 코드를 사용할 수 없습니다 : 나는 그런 코드를 작성할 수의 GData API를 사용하여 . 그런 식으로 new V3 api를 사용하여 로그인과 비밀번호로 어떻게 인증 할 수 있는지 말해주십시오. 당신은 V3와 사용자 이름과 암호를 사용하여 권한을 부여 할 수

답변

1

, 그것은 당신의 범위는 구글 캘린더 설정되어 있는지 확인하십시오 당신이 액세스 토큰을 얻을으로 OAuth2를 사용하기 만하면 무엇 OAuth2를

를 사용합니다. 새로 고침 토큰을 어딘가에 저장 한 다음 원하는 모든 항목에 액세스 할 수 있습니다.

관련 문제