Back to project page gameapi-android.
The source code is released under:
MIT License
If you think the Android project gameapi-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.playtomic.android; /*www.j ava 2 s. c o m*/ import org.json.JSONObject; public class GeoIP { private static String SECTION = "geoip"; private static String LOOKUP = "lookup"; /** * Performs a lookup request of the player's country * @param callback GeoIPHandler for receiving the response and data */ public static void lookup(final GeoIPHandler callback) { PRequest.load(SECTION, LOOKUP, null, new PResponseHandler() { @Override public void onResponse(PResponse response, JSONObject data) { if(response.getSuccess()) { PlayerCountry country = new PlayerCountry(); country.setName(data.optString("name")); country.setCode(data.optString("code")); callback.onSuccess(country, response); } else { callback.onFailure(response); } } }); } }