-
-
Save mojodna/783757 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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