views:

145

answers:

2

I'm building some basic Twitter functionality into my app, and am using the JTwitter JAR to read and set status.

It looks like there is a User class that can be used to set the location, but I just can't figure out how to set it with my GPS coordinates once I've got my Twitter object.

Has anyone been able to set the user.location property using JTwitter?

Thanks, -Gregg

A: 

It would appear that JTwitter doesn't support this.

The Twitter API method /statuses/update takes lat and long arguments (or a single place_id argument) to specify the location.

Looking at the source (line ~2500), the updateStatus method of JTwitter only passes the status, source and in_reply_to_status_id arguments. You'll need to modify the JTwitter source to pass the lat/long arguments if you want to geotag your tweets.

Chris Smith
Ah, ok. Thanks for the quick response!-Gregg
Gregg Reno
Just updated the updateStatus function to add the lat and long arguments, and it works great. Thanks again.
Gregg Reno
+1  A: 

Sorry for the omission!

I've just added support for setting your location to the latest version (v1.6.2). See Twitter.setMyLocation().

NB - location based searches are handled separately via setSearchLocation(), as they need long, lat and radius.

Daniel Winterstein

related questions