Do you type the correct password?
myService.setUserCredentials("[email protected]","xxxxxxxxx");
I use the google Data API, and it can get the google Calendar Entries
size in console screen.
On 1月3日, 下午4時48分, shleeforandroid <[email protected]> wrote:
> hi.
>
> I have some problems with android apps using Calendar API.
>
> I want to authenticate to google Data API (Calendar API) and retrieve
> my calendars and calendar's events.
> I have downloaded the gdata(gdata-src.java-1.28.0.java.zip ) from
>
> http://code.google.com/p/gdata-java-client/downloads/list
>
> I found the source similar to Calendar Apps, and some examples.
> But these use the previous version of gdata so, i can't understand
> where to go some important classes or packages.
>
> Here is my test code.
>
> private boolean authentication(String user, String pass) {
>
> mCalendarService = new CalendarService("fue-WAI-1");
>
> // Create the necessary URL objects.
> try {
> mUserCalendarUrl = new URL
> (CalendarService.CALENDAR_ROOT_URL+
> Uri.encode(USERNAME));
>
> // USERNAME = [email protected]
>
> } catch (MalformedURLException e) {
> // Bad URL
> e.printStackTrace();
> return false;
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> try {
> mCalendarService.setUserCredentials(USERNAME,
> PASSWORD);
>
> mAuthTokenFactory =
> mCalendarService.getAuthTokenFactory();
>
> mAuthToken = mAuthTokenFactory.getAuthToken();
>
> mRequest = mCalendarService.createFeedRequest
> (mUserCalendarUrl);
>
> =========> error occurs in here. <=========
>
> mRequest.execute();
>
> mParserSource = mRequest.getParseSource();
>
> mCalFeed = ParseUtil.readFeed(mParserSource);
>
> } catch (AuthenticationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> return false;
> } catch (ServiceException e) {
> // TODO Auto-generated catch block
>
> if(e.equals(RedirectRequiredException.class)){
> RedirectRequiredException eRRx =
> (RedirectRequiredException)
> e.getCause();
> String loc = eRRx.getRedirectLocation();
> }
> e.printStackTrace();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> return true;
>
> }
>
> and there are some codes that i referenced below two link.
>
> 1>http://www.koders.com/info.aspx?c=ProjectInfo&pid=ZUCKKP7CXQN7EMN6UPP...
>
> 2>http://code.google.com/p/androidlbs/source/browse/SampleCalendar/src/...
>
> and last is error log I encountered.
>
> 01-03 08:11:38.578: WARN/System.err(193):
> com.google.gdata.util.RedirectRequiredException: Moved Temporarily
> 01-03 08:11:38.578: WARN/System.err(193): <HTML>
> 01-03 08:11:38.578: WARN/System.err(193): <HEAD>
> 01-03 08:11:38.578: WARN/System.err(193): <TITLE>Moved Temporarily</
> TITLE>
> 01-03 08:11:38.587: WARN/System.err(193): </HEAD>
> 01-03 08:11:38.587: WARN/System.err(193): <BODY BGCOLOR="#FFFFFF"
> TEXT="#000000">
> 01-03 08:11:38.587: WARN/System.err(193): <H1>Moved Temporarily</H1>
> 01-03 08:11:38.587: WARN/System.err(193): The document has moved <A
> HREF="http://www.google.com/~... ">here</A>.
> 01-03 08:11:38.587: WARN/System.err(193): </BODY>
> 01-03 08:11:38.587: WARN/System.err(193): </HTML>
> 01-03 08:11:38.607: WARN/System.err(193): at
> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse
> (GoogleGDataRequest.java:553)
> 01-03 08:11:38.607: WARN/System.err(193): at
> com.google.gdata.client.http.HttpGDataRequest.checkResponse
> (HttpGDataRequest.java:502)
> 01-03 08:11:38.617: WARN/System.err(193): at
> com.google.gdata.client.http.HttpGDataRequest.execute
> (HttpGDataRequest.java:481)
> 01-03 08:11:38.617: WARN/System.err(193): at
> com.google.gdata.client.http.GoogleGDataRequest.execute
> (GoogleGDataRequest.java:527)
>
> ...
>
> 01-03 08:11:38.627: WARN/System.err(193): at
> android.view.View.performClick(View.java:2109)
> 01-03 08:11:38.637: WARN/System.err(193): at
> android.view.View.onTouchEvent(View.java:3523)
> 01-03 08:11:38.637: WARN/System.err(193): at
> android.widget.TextView.onTouchEvent(TextView.java:4410)
> 01-03 08:11:38.637: WARN/System.err(193): at
> android.view.View.dispatchTouchEvent(View.java:3178)
> 01-03 08:11:38.637: WARN/System.err(193): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857)
> 01-03 08:11:38.648: WARN/System.err(193): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857)
> 01-03 08:11:38.648: WARN/System.err(193): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857)
> 01-03 08:11:38.658: WARN/System.err(193): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857)
> 01-03 08:11:38.658: WARN/System.err(193): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857)
> 01-03 08:11:38.658: WARN/System.err(193): at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.superDispatchTouchEvent(PhoneWindow.java:1561)
> 01-03 08:11:38.658: WARN/System.err(193): at
> com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
> (PhoneWindow.java:1085)
> 01-03 08:11:38.658: WARN/System.err(193): at
> android.app.Activity.dispatchTouchEvent(Activity.java:1873)
> 01-03 08:11:38.658: WARN/System.err(193): at
> com.android.internal.policy.impl.PhoneWindow
> $DecorView.dispatchTouchEvent(PhoneWindow.java:1545)
> 01-03 08:11:38.658: WARN/System.err(193): at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1140)
> 01-03 08:11:38.678: WARN/System.err(193): at
> android.os.Handler.dispatchMessage(Handler.java:88)
> 01-03 08:11:38.678: WARN/System.err(193): at
> android.os.Looper.loop
> (Looper.java:123)
> 01-03 08:11:38.678: WARN/System.err(193): at
> android.app.ActivityThread.main(ActivityThread.java:3742)
> 01-03 08:11:38.678: WARN/System.err(193): at
> java.lang.reflect.Method.invokeNative(Native Method)
> 01-03 08:11:38.678: WARN/System.err(193): at
> java.lang.reflect.Method.invoke(Method.java:515)
> 01-03 08:11:38.678: WARN/System.err(193): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> (ZygoteInit.java:739)
> 01-03 08:11:38.678: WARN/System.err(193): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
> 01-03 08:11:38.678: WARN/System.err(193): at
> dalvik.system.NativeStart.main(Native Method)
>
> Thanks to read this long question and your help ~
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---