0

I want to tweet on android app. I create app in adroid and I give permission read and write. I get tokens and consumer keys, And I write this code :

String token ="<Your access token>"; 
        String secret = "<Your access token secret>";
        AccessToken a = new AccessToken(token,secret);
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.setOAuthConsumer("<Your consumer key>", "<Your consumer secret>");
        twitter.setOAuthAccessToken(a);
        try {
            twitter.updateStatus("android test");
        } catch (TwitterException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

But it gives error :

403:The request is understood, but it has been refused. 
An accompanying error message will explain why. 
This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
Relevant discussions can be on the Internet at:
    http://www.google.co.jp/search?q=b2b52c28 
    or
    http://www.google.co.jp/search?q=1b442886
TwitterException{exceptionCode=[b2b52c28-1b442886], statusCode=403, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5}

how can I solve this?

user3086226
  • 93
  • 1
  • 7
  • 18
  • Prima facie the answer is obvious: you bumped the limits cited in the error message (number of tweets etc.). So I guess the real question is if you got this message unexpectedly (e.g. sending first tweet of the day). – epx Feb 09 '14 at 21:27
  • I ddid not post in the past why you think I bumped the limits? – user3086226 Feb 09 '14 at 21:35

1 Answers1

1

You are getting this exception might be because of the earlier versioned twitter4j library. I suggest you to upgrade the library to latest version (twitter4j-core-3.0.5.jar).

Download twitter4j-core-3.0.5.jar

Ritesh Gune
  • 16,629
  • 6
  • 44
  • 72