Sunday, June 22, 2014

OAuth 2.0 in Android part - 2



Using Tasks API (Account manager)

Using account manager here, device google accounts are shown in dialog box and by selecting one shows grant permission page and then access_token is retrieved. 


Process to use tasks api in your project.


  • Import Google client libraries  google-api-java-client-1.4.1-beta.zip and task specific jar google-api-services-tasks-v1-1.1.0-beta.jar
  • Select the Google Account of the user through Account Manager.
  • Generate API key and set up the Tasks service object
    • Create a project or use an existing one in google console.
    • Enable the Tasks API on your project in google console by toggling the Tasks API switch to ON
    • The API Key can be found at API Access > Simple API Access > API Key
  • Get an OAuth 2.0 access token from the AccountManager for the Task API
  • Make calls to the Tasks API

  1. Below is the flowchart to explain the process in pictorial way to get a better idea.





Through application user is navigated to below screens and asked to grant permission to obtain access token.






0 comments:

Post a Comment