0

In my Android application I am integrated the Google+ API, I have already verified the access and scopes. I want to insert the comments and New Post in my android application. I am integrated the Post method with google documentation. The reference is https://developers.google.com/+/domains/posts/creating

MainActivity.java

   //Set the accesstoken
         GoogleCredential credential = new 
  GoogleCredential().setAccessToken( token );

    // Create a list of ACL entries
            PlusDomainsAclentryResource resource = new PlusDomainsAclentryResource();
            resource.setType("domain"); // Share to domain
            List<PlusDomainsAclentryResource> aclEntries =
                    new ArrayList<PlusDomainsAclentryResource>();
            aclEntries.add(resource);

            Acl acl = new Acl();
            acl.setItems(aclEntries);
            acl.setDomainRestricted(true);  // Required, this does the domain restriction

  // Create a new activity object
            com.google.api.services.plusDomains.model.Activity   activity = new com.google.api.services.plusDomains.model.Activity()
                    .setObject(new com.google.api.services.plusDomains.model.Activity.PlusDomainsObject().setOriginalContent(comments))
                    .setAccess(acl);
//Execute the API
            com.google.api.services.plusDomains.model.Activity plusDomains = new PlusDomains(common.HTTP_TRANSPORT, common.JSON_FACTORY, credential ).activities().insert("me",activity)
                    .execute();

I got the below Error. I Refer the below links but not its not working

Google coordinate authentication

com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 
Unauthorized
W/System.err: {
W/System.err:   "code" : 401,
W/System.err:   "errors" : [ {
W/System.err:     "domain" : "global",
W/System.err:     "location" : "Authorization",
W/System.err:     "locationType" : "header",
W/System.err:     "message" : "Invalid Credentials",
W/System.err:     "reason" : "authError"
W/System.err:   } ],
 W/System.err:   "message" : "Invalid Credentials"
W/System.err: }
Cœur
  • 37,241
  • 25
  • 195
  • 267
sivaprakash
  • 528
  • 6
  • 15

0 Answers0