3

I want to develop an Android app that will fetch geo-tagged tweets from Twitter public timeline based on user's (current/specified) location. I will have a refresh button and more tweets (custom size of 30 max) will be fetched if available in that particular time.

So which API is suitable for this case? Search API or Streaming API.

I will use Twitter4J library.

Tahir
  • 3,344
  • 14
  • 51
  • 69
  • Will this URL give me latest tweets? search.twitter.com/search.json?geocode=37.781157,-122.398720,1mi I can go with this. – Tahir Feb 21 '12 at 14:05

1 Answers1

2

The streaming API requires that you keep the connection active. This requires a server process with an infinite loop, to get the latest tweets.

Advantage

1)Lag in retrieving results: Tweets delivered with this method are basically real-time, with a lag of a second or two at most between the time the tweet is posted and it is received from the API

2)Not rate limited.

The search API is the easier of the two methods to implement but it is rate limited .Each request will return up to 100 tweets, and you can use a page parameter to request up to 15 pages, giving you a theoretical maximum of 1,500 tweets for a single query.

Advantage

1)Finding tweets in the past:The search API wins by default in this area, because the streaming API doesn’t deliver any past tweets

2)Easier to implement

In your case, for real time tweets, you can go for streaming API if your number of requests are high.

Please visit this link for more details.

samridhi
  • 500
  • 2
  • 10
  • Location thing is complex in Streaming API, like you have to make a box for getting tweets in that area. Where as in Search API, you can get tweets by giving your lat/long and radius. But the resultset is not geo-tagged. Then why those tweets were fetched in that result. Profile location is not that authentic thing. Any idea here? – Tahir Feb 22 '12 at 10:40
  • **Then why those tweets were fetched in that result?** By this, do you mean, the result retrieved after passing lat/long and radius? – samridhi Feb 22 '12 at 11:38
  • Yes these tweets are part of the result of my query to Search API with lat/long and radius. But their geo-code location is null. So they fetched based on their profile. My question is, is this approach is good to fetch these tweets? As they have are coming to me because of their profile location. Not their geo-code data. – Tahir Feb 22 '12 at 11:41
  • Though it is not reliable, but if the Geo-code location is not null for all the results, you can bifurcate the records into those which are Geo-tagged and those which are not. By, doing this, you will be aware of which records are exactly reliable and which records may be fallacious. – samridhi Feb 22 '12 at 11:54