Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6946553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:34:46+00:00 2026-05-27T13:34:46+00:00

I’ve started programming an Android application which implements a ListView and a simple Database

  • 0

I’ve started programming an Android application which implements a ListView and a simple Database and offers the opportunity to receive tasks from a specific Google Account and than add them to the ListView.

I used this Tutorial and the Tasks API to implement the code, but it doesn’t work and there aren’t many other tutorials on the web. Here’s a snippet of my Start-Activity.

I created only one account on my phone, so I left out the ‘Choose Accounts’-Dialog:

googleAccountManager = new GoogleAccountManager(RememberMe.this);
Account[] accounts = googleAccountManager.getAccounts();
account = accounts[0];
googleAccountManager.manager.getAuthToken(account, AUTH_TOKEN_TYPE, null, this, new AccountManagerCallback<Bundle>() 
            {
                public void run(AccountManagerFuture<Bundle> future) 
                    {
                        try 
                            {
                                // If the user has authorized your application to use the tasks API
                                // a token is available.
                                String token = future.getResult().getString(AccountManager.KEY_AUTHTOKEN);
                                HttpTransport transport = AndroidHttp.newCompatibleTransport();
                                GoogleAccessProtectedResource googleAccessProtectedResource = new GoogleAccessProtectedResource(token);
                                service = new Tasks(transport, googleAccessProtectedResource, new JacksonFactory());
                                service.setKey("AIzaSyDAnO-UGa_zJnqftSVTHnvoHDp8Tfrmtko");
                                service.setApplicationName("Remember Me");
      
      

                                receivingTasks();
                                // Now you can use the Tasks API...
                                
                            } 
                        catch (OperationCanceledException e) 
                            {
                                // TODO: The user has denied you access to the API, you should handle that
                                Log.w(TAG, "synchronize - Catch OperationCanceled Exception");
                            } 
                        catch (Exception e) 
                            {
                                Log.w(TAG, "synchronize - Catch Exception e");
                            }
                    }
          }, null);

Here is the ‘receiveTasks’-Method:

    public void receivingTasks()
    {
        try 
        {
            TaskLists taskLists = service.tasklists.list().execute();
            for (TaskList taskList : taskLists.getItems()) 
            {
                  Log.w(TAG, "" + taskList.getTitle());
            }
        }
        catch (IOException e) 
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

Everything’s working fine – I get a token, there’s a service-Object and a Account-Object – but when we get to

TaskLists taskLists = service.tasklists.list().execute();

it throws an exception and nothing happens, so I guess the TaskLists – Object isn’t initialized, but I have no idea why "it is unable to respond" (LogCat).

Here’s the LogCat:

11-29 15:57:58.848: W/DefaultRequestDirector(2878): Authentication error: Unable to respond to any of these challenges: {authsub=WWW-Authenticate: AuthSub realm="https://www.google.com/accounts/AuthSubRequest" allowed-scopes="https://www.googleapis.com/auth/tasks,https://www.googleapis.com/auth/tasks.readonly"}

11-29 15:57:58.858: W/System.err(2878): com.google.api.client.http.HttpResponseException: 401 Unauthorized

11-29 15:57:58.858: W/System.err(2878):     at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:669)

11-29 15:57:58.868: W/System.err(2878):     at com.google.api.services.tasks.Tasks$RemoteRequest.execute(Tasks.java:1571)

11-29 15:57:58.868: W/System.err(2878):     at com.google.api.services.tasks.Tasks$Tasklists$List.executeUnparsed(Tasks.java:1277)

11-29 15:57:58.868: W/System.err(2878):     at com.google.api.services.tasks.Tasks$Tasklists$List.execute(Tasks.java:1262)

I also wonder where the different between the tutorial and the API is, it would be great if someone could help me, because i don’t know where else i could find help about this topic.
Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:34:47+00:00Added an answer on May 27, 2026 at 1:34 pm

    For everybody who got the same problem, try to save the token in the Shared Preferences and invalidate it every time the application is started and generate a new one due to a bug of the Account Manager; my problem could be solved this way:
    See this:
    https://groups.google.com/group/google-tasks-api/browse_thread/thread/6d65116019baf122/81293191c46ebdc6?lnk=gst&q=401#81293191c46ebdc6

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.