Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.util.ArrayList;
- import org.apache.log4j.BasicConfigurator;
- import com.simplegeo.client.SimpleGeoPlacesClient;
- import com.simplegeo.client.callbacks.FeatureCollectionCallback;
- import com.simplegeo.client.types.Feature;
- import com.simplegeo.client.types.FeatureCollection;
- import com.simplegeo.client.types.Point;
- public class DelayedRequest {
- public static void main(String[] args) throws InterruptedException {
- BasicConfigurator.configure();
- String secret = ""; //secret
- String key = ""; //key
- SimpleGeoPlacesClient client = SimpleGeoPlacesClient.getInstance();
- client.getHttpClient().setToken(key, secret);
- double radius = 25;
- for (int i=0; i< 5; i++) {
- System.out.println("Waiting..");
- // wait 10 mins
- Thread.sleep(10 * 1000 * 60);
- try {
- System.out.println("Commencing Search...");
- client.search(new Point(33.55, -122.48), "", "Restaurant", radius,
- new FeatureCollectionCallback() {
- public void onSuccess(FeatureCollection collection) {
- ArrayList<Feature> features = collection.getFeatures();
- for (Feature feature : features) {
- System.out.println(feature.getProperties().get("name"));
- }
- }
- public void onError(String errorMessage) {
- System.out.println("Error: " + errorMessage);
- }
- });
- } catch (IOException e) {
- System.out.println("Exception: " + e.getMessage());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment