Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing The Google Maps Geolocation API
    primarykey
    data
    text
    <p>I am Using following code to get the lat. long. by providing MCC, MNC I am using Google Maps Geo-location API for this but I am getting same results (lat/long) for different MCC/MNC values . Even when I am requesting blank json I am getting same results(lat/long). Where am I going wrong ?</p> <pre><code>public class CellID { public static void main(String[] args) { try{ putDataToServer("https://www.googleapis.com/geolocation/v1/geolocate?key=mykey",null); } catch(Throwable throwable){ System.out.println("Error"); } } public static String putDataToServer(String url,JSONObject returnedJObject) throws Throwable { HttpPost request = new HttpPost(url); JSONStringer json = (JSONStringer) new JSONStringer() .object() .key("mobileCountryCode").value(504) .key("mobileNetworkCode").value(0) .key("locationAreaCode").value(0) .key("cellID").value(0) .endObject(); System.out.println("json"+json.toString()); StringEntity entity = new StringEntity(json.toString(), "UTF-8"); request.setEntity(entity); HttpResponse response =null; HttpClient httpClient = new DefaultHttpClient(); try{ response = httpClient.execute(request); } catch(SocketException se) { throw se; } BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); //Displaying the response received. String line = ""; while ((line = rd.readLine()) != null) { System.out.println(line); if (line.startsWith("Auth=")) { String key = line.substring(5); // Do something with the key } } return response.getEntity().toString(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload