简体   繁体   中英

twitter4j get tweets by GeoLocation

I have a task, where I need to get tweets using twitter4j by Geo Location, everything about OAuth and tokens I did correctly, but when I'm trying to create a query getting a problem with method geoCode();
During compilation process I'm getting an error :

Error:(148, 60) java: cannot find symbol
  symbol:   method geoCode(twitter4j.GeoLocation,double,java.lang.String)
  location: class javax.management.Query

I don't understand what is going wrong...
My Query code:

double lat = 59.4372155;
double lon = 24.7453688;
double res = 5;
String resUnit = "mi";
QueryResult result = twitter.search(new Query().geoCode(new GeoLocation(lat,lon),res, resUnit));

If you need any more code, please tell me which part, I will UPDATE the Post

Try to break it down first and work from there:

Query query = new Query().geoCode(new GeoLocation(lat,lon), res, resUnit); 
query.count(11); //You can also set the number of tweets to return per page, up to a max of 100
QueryResult result = twitter.search(query);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM