Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top