Skip to content

Instantly share code, notes, and snippets.

@mojodna
Forked from caseycrites/SimpleJavaClass.java
Created January 18, 2011 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojodna/783757 to your computer and use it in GitHub Desktop.
Save mojodna/783757 to your computer and use it in GitHub Desktop.
package com.simplejavaapp;
import java.io.IOException;
import java.util.ArrayList;
import com.simplegeo.client.SimpleGeoPlacesClient;
import com.simplegeo.client.callbacks.FeatureCollectionCallback;
import com.simplegeo.types.Feature;
import com.simplegeo.types.FeatureCollection;
public class SimpleJavaClass {
public static void main(String[] args) {
SimpleGeoPlacesClient client = SimpleGeoPlacesClient.getInstance();
client.getHttpClient().setToken("oauth-key", "oauth-secret");
double radius = 25;
try {
client.searchByIP("", "", "", radius, new FeatureCollectionCallback() {
public void onSuccess(FeatureCollection collection) {
for (Feature feature : collection.getFeatures()) {
System.out.println(feature.getProperties().get("name"));
}
}
// implementing this method should be optional
public void onError(String errorMessage) {
System.out.println(errorMessage);
}
});
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment