android - Get Public tweets Twitter API 1.1 -


i first time on twitter api's

i going through https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

i need public tweets https://twitter.com/twitterapi

the api 1.1 link says-

authentication - required

and found - authtool

i couldn't connect these things, there no beginner tutorial available.

my basic doubts - authentication required means - end user using app should have twitter account these tweets? ( planing mobile app ( android), show celebrity's public tweets )

  • where can find basic tutorials begin with?

  • do need tokens pass request? how those?

i had chance work on similar issue. let me questions first.

does authentication required means - end user using app should have twitter account these tweets?

no. end user need not have sign twitter account see public feeds. but, have use consumer key , secret key app have created in twitter developers website.

do need tokens pass request? how those?

as have explained previous question, need make use of consumer key, consumer secret, access token , access secret.

here little example worked on public feeds. below sample fetch latest 20 public feeds of user.

before need import latest twitter library project twitter4j 3.0.3 of now.

and add below given code project , should done.

configurationbuilder cb = new configurationbuilder();         cb.setdebugenabled(true)                 .setoauthconsumerkey("b***************q")                 .setoauthconsumersecret(                         "l*********************************o")                 .setoauthaccesstoken(                         "1*******************************x")                 .setoauthaccesstokensecret(                         "1***************************c");         twitterfactory tf = new twitterfactory(cb.build());         twitter twitter = tf.getinstance();         try {             list<status> statuses;             string user;             user = "replace user name of choice";             statuses = twitter.getusertimeline(user);             log.i("status count", statuses.size() + " feeds");             (int = 0; < statuses.size(); i++) {                 status status = statuses.get(i);                 log.i("tweet count " + (i + 1), status.gettext() + "\n\n");             }         } catch (twitterexception te) {             te.printstacktrace();         } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -