Vote count:
0
I am trying to upload an image to Twitter with the following code but I get a limit error:
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey(TwitterConst.CONSUMER_KEY);
builder.setOAuthConsumerSecret(TwitterConst.CONSUMER_SECRET);
String access_token = mSharedPreferences.getString(TwitterConst.PREF_KEY_TOKEN, "");
String access_token_secret = mSharedPreferences.getString(TwitterConst.PREF_KEY_SECRET, "");
AccessToken accessToken = new AccessToken(access_token, access_token_secret);
Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken);
StatusUpdate status = new StatusUpdate("Sample message: " + args[0] + " - Download it from Google Play at goo.gl/xxxxxx");
if (foto_to_share.equals("https://www.mywebsite.com/Folder/default/fb_stub.png")) {
status.setMedia(String_to_File("https://www.mywebsite.com/Folder/default/fb_stub.png"));
} else {
status.setMedia(String_to_File("http://www.mywebsite.com/Folder/upload/" + session_userid + "/" + foto_to_share));
}
twitter4j.Status response = twitter.updateStatus(status);
The first image is 139 KB, the second one is 140 KB large. Both images are on the web, the String_to_File
method downloads them to the SD card.
I am sure I haven't reached any limits I know as I can't post the image, but I can tweet a message.
The error:
11-29 18:14:23.090: W/System.err(14264): 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).
11-29 18:14:23.090: W/System.err(14264): message - Error creating status.
11-29 18:14:23.090: W/System.err(14264): code - 189
11-29 18:14:23.090: W/System.err(14264): Relevant discussions can be found on the Internet at:
11-29 18:14:23.090: W/System.err(14264): http://www.google.co.jp/search?q=2fc5b7cb or
11-29 18:14:23.090: W/System.err(14264): http://www.google.co.jp/search?q=0e8e77fd
11-29 18:14:23.090: W/System.err(14264): TwitterException{exceptionCode=[2fc5b7cb-0e8e77fd], statusCode=403, message=Error creating status., code=189, retryAfter=-1, rateLimitStatus=null, version=4.0.2}
11-29 18:14:23.090: W/System.err(14264): at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:163)
11-29 18:14:23.090: W/System.err(14264): at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
11-29 18:14:23.090: W/System.err(14264): at twitter4j.HttpClientBase.post(HttpClientBase.java:82)
11-29 18:14:23.090: W/System.err(14264): at twitter4j.TwitterImpl.post(TwitterImpl.java:1592)
11-29 18:14:23.090: W/System.err(14264): at twitter4j.TwitterImpl.updateStatus(TwitterImpl.java:213)
11-29 18:14:23.090: W/System.err(14264): at com.example.blgui3.BucketProfileActivity$updateTwitterStatusImage.doInBackground(BucketProfileActivity.java:3619)
11-29 18:14:23.090: W/System.err(14264): at com.example.blgui3.BucketProfileActivity$updateTwitterStatusImage.doInBackground(BucketProfileActivity.java:1)
11-29 18:14:23.090: W/System.err(14264): at android.os.AsyncTask$2.call(AsyncTask.java:288)
11-29 18:14:23.090: W/System.err(14264): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-29 18:14:23.090: W/System.err(14264): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
11-29 18:14:23.090: W/System.err(14264): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
11-29 18:14:23.100: W/System.err(14264): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
11-29 18:14:23.100: W/System.err(14264): at java.lang.Thread.run(Thread.java:864)
Any ideas?
asked 37 secs ago
Unable to post image to Twitter due to update limit error
Aucun commentaire:
Enregistrer un commentaire