Skip to content

Instantly share code, notes, and snippets.

@twaddington
Created March 18, 2012 05:39
Show Gist options
  • Save twaddington/2069215 to your computer and use it in GitHub Desktop.
Save twaddington/2069215 to your computer and use it in GitHub Desktop.
Geoloqi Android SDK: Simple POST Request
if (mService != null) {
LQSession session = mService.getSession();
// Build your request
try {
JSONObject geonote = new JSONObject();
geonote.put("text", "Test!");
geonote.put("latitude", 45.5037078163837);
geonote.put("longitude", -122.622699737549);
geonote.put("radius", 467);
geonote.put("place_name", "Grocery Store");
} catch (JSONException e) {
// Pass
}
// Send the request
session.runPostRequest("geonote/create", geonote, new OnRunApiRequestListener() {
@Override
public void onComplete(HttpResponse response) {
try {
Log.d(TAG, EntityUtils.toString(response.getEntity()));
} catch (ParseException e) {
// Pass
} catch (IOException e) {
// Pass
}
}
@Override
public void onFailure(LQSession session, LQException e) {
// Pass
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment