Saturday, March 12, 2011

[android-developers] Help regarding google-java-api client library

Hi,

I am trying to make a an android application which lists, uploads and downloads all the documents stored in ones google documents account.

Following is what all i have already tried :
Using 3 legged Oauth verification method, where in i take a temp token first, open that in the browser let the user authenticate himself, and then retrieve the oauth-verifierusing call back.

Now the problem : After getting the OAuth token back i am not able to sign it into transport. IT give me a Null Pointer Exception.

Following is the code,


public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        final Uri uri = intent.getData();
        if (uri != null && uri.getScheme().equals("x-somename-google")) {
       
            final String oauth_verifier = uri.getQueryParameter("oauth_verifier");

            Log.d("oauth_verifier", oauth_verifier);
           
            GoogleOAuthGetAccessToken accessToken = new GoogleOAuthGetAccessToken();
            accessToken.temporaryToken = tempToken;
            accessToken.signer = signer;
            accessToken.consumerKey = "anonymous";
            accessToken.verifier = oauth_verifier;
            try {
                credentials = accessToken.execute();
                signer.tokenSharedSecret = credentials.tokenSecret;
            createOAuthParameters().signRequestsUsingAuthorizationHeader(transport); ----------> I get a null pointer exception here.
               
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
           
         

Exact log cat output :

03-12 16:48:54.311: ERROR/AndroidRuntime(1245): FATAL EXCEPTION: main
03-12 16:48:54.311: ERROR/AndroidRuntime(1245): java.lang.NullPointerException
03-12 16:48:54.311: ERROR/AndroidRuntime(1245):     at com.google.api.client.auth.oauth.OAuthParameters.signRequestsUsingAuthorizationHeader(OAuthParameters.java:226)





I would be great if someone could please point me in the right direction. Also, any links on downloading and uploading of documents to google documents would also be helpful.

Thanks
--
Cuil

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment