twitter4j

How to post picture to Twitter using twitter4j library in Android

懵懂的女人 提交于 2019-12-23 04:26:37
问题 I want to post image to twitter on my app. I use "twitter4j" library to post only text. But i cannot find how to post image with text. Thanks for help. 回答1: To post a image you have to use media extension of Twitter4j and register your app with either TwitPic or YFrog . Get KEY and TOKEN from those services and then /* * Upload File to twitPic and get url . Then append this url to your twitter message. */ public static String upload_twic_pic(File file) throws TwitterException { String url =

Can't post image to Twitter. Received authentication challenge is null

試著忘記壹切 提交于 2019-12-23 03:13:39
问题 After the login flow, I store access token and accesss token secret in prefs. Now I want to post image to Twitter using TwitPic. Updated: I tried to set date&time on device to automatic. The callback URL in my Twitter app exists. It still shows error. My code public static boolean tweetMessageAndPhoto(final String message, final String photoPath) { final ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthAccessToken(getAccessTokenStr()); cb

Error processing your OAuth request: Invalid oauth_verifier parameter

让人想犯罪 __ 提交于 2019-12-22 18:08:25
问题 I'm following https://dev.twitter.com/web/sign-in/implementing to implement OAuth signup in my application with twitter. Here is the service which presents the User the authorize this app dialog from twitter: @GET @Produces(MediaType.APPLICATION_JSON) @Path("/twitter") public Response redirectToTwitter() { Configuration cfg = new ConfigurationBuilder().setOAuthConsumerKey(TWITTER_CONSUMER_KEY) .setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET) .build(); Twitter twitter = new TwitterFactory(cfg)

Android Connection With Twitter - Get null answer from twitter

孤街醉人 提交于 2019-12-22 08:52:30
问题 I have a %&·$5#~€ problem with the connection to twitter. (The code is post below this) First, I have all configured (twitter keys, callback in the manifest, etc), then I do the call to twitter and get browser open, then I signIn in twitter and I accept the application, then the browser returns to application and try to get the response from twitter, but I get NULL as answer. Can anyone help me to find what's going on with this? Grettings PD: I follow this tutorial : http://www.androidhive

Android : App is opened in browser when coming back from Twitter login page (login page is displayed in browser)

删除回忆录丶 提交于 2019-12-21 21:49:00
问题 I have integrated Twitter into android app. User is displayed login screen for Twitter in browser. When user is done with login, flow should return back to app. So here actually after login, app's screen is displayed. But when I put all apps in background by pressing home button and then check all opened apps (by long pressing home button) it shows my app and browser as shown below. Browser app has my app screen.i.e. flow is not returned back to my app, rather app is opened in browser. This

Post a tweet with Android API

╄→尐↘猪︶ㄣ 提交于 2019-12-21 16:49:23
问题 I've been searching for a way to post a tweet with my Android application, but all the things I've found don't work. I have to admit that Twitter's API isn't so simple to understand, but my code isn't really long, and I don't see where is my mistake. This is my code: public class PartagerTwitter extends Activity { private CommonsHttpOAuthConsumer httpOauthConsumer; private OAuthProvider httpOauthprovider; public final static String consumerKey = XXX; public final static String consumerSecret

Does twitter4j provide the capability to search tweets between 2 dates

有些话、适合烂在心里 提交于 2019-12-21 05:40:53
问题 Does twitter4j provide the capability to search tweets between 2 dates (e.g. 2011-10-27 05:30:00 to 2011-10-27 06:30:00) currently it seems to have the granularity of a date and not hours or minutes. 回答1: No, at the current version there is no way to specify date & time for searching within given range. And that's the limitation of Twitter search API: Notes about Search Operators since and until do not support the negation (-) operator. List item should be entered in the format year-month-day

Twitter4j : Search for public tweets

僤鯓⒐⒋嵵緔 提交于 2019-12-20 18:07:53
问题 How does one search within public tweets using the Twitter4j library ? public static void main(String[] args) { Twitter twitter = new TwitterFactory().getInstance(); try { Query query = new Query("Cocaine"); QueryResult result; do { result = twitter.search(query); List<Status> tweets = result.getTweets(); for (Status tweet : tweets) { System.out.println("@" + tweet.getUser().getScreenName() + " - " + tweet.getText()); } } while ((query = result.nextQuery()) != null); System.exit(0); } catch

how to get media related info using twitter4j

允我心安 提交于 2019-12-20 15:34:52
问题 I am new to twitter4j. How i can get media related info using twitter4j library? I want to get info about photos,videos and article summary present in tweet.Thanks in advance.Is getMediaEntities() method is enough for this purpose? 回答1: Try hitting this request: https://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitter&include_entities=true Then, look for any media_url elements; those will contain the URL to any photos. It may contain video links, so you'll have to filter for

how to stop and kill the Twitter4j stream correctly

老子叫甜甜 提交于 2019-12-20 05:30:47
问题 I try to use the Twitter4j streaming features. So my implementation is in the following class : public class TweetsStream { private TwitterStream m_twitterstream; private StatusListener m_statusListener; public void printStream(...) // Stream m_twitterstream = null; m_twitterstream = TwitterStreamFactory.getSingleton(); // Listener m_statusListener = new StatusListenerRedefined(...); m_twitterstream.addListener(m_statusListener); // Filter FilterQuery l_filter = new FilterQuery(); l_filter