2013-01-23 26 views
6

मैं एंड्रॉइड पर Google geolocation एपीआई का उपयोग करने की कोशिश कर रहा हूं। मुझे यकीन है कि मेरे पास एंड्रॉइड के लिए वैध apikey है और मैंने बिलिंग सक्षम किया है। हालांकि, सर्वर की ओरGoogle मानचित्र जिओलोकेशन एपीआई: कॉन्फ़िगर नहीं किया गया

doman: usageLimits reson: पहुँच कॉन्फ़िगर नहीं किया गया कोड: 403

किसी को भी इस समस्या को हल कर सकते हैं? पीएस: मेरे पास Google मानचित्र विकास के लिए एंटरप्राइज़ समर्थन नहीं है। मेरा कोड

JSONObject holder = new JSONObject(); 
JSONArray cellarray = new JSONArray(); 
JSONArray wifiarray = new JSONArray(); 
JSONObject cell = new JSONObject(); 
JSONObject wifi1 = new JSONObject(); 
JSONObject wifi2 = new JSONObject(); 
try { 
    cell.put("cellId", cid); 
    cell.put("locationAreaCode", lac); 
    cell.put("mobileCountryCode", mcc); 
    cell.put("mobileNetworkCode", mnc); 
    cell.put("age", 0); 
    cell.put("signalStrength", -95); 
    cellarray.put(cell); 

    wifi1.put("macAddress", "01:23:45:67:89:AB"); 
    wifi1.put("signalStrength", 8); 
    wifi1.put("age", 0); 
    wifi1.put("signalToNoiseRatio", -65); 
    wifi1.put("channel", 8); 
    wifiarray.put(wifi1); 

    wifi2.put("macAddress", "01:23:45:67:89:AC"); 
    wifi2.put("signalStrength", 4); 
    wifi2.put("age", 0); 
    wifiarray.put(wifi2); 

    holder.put("homeMobileCountryCode", mcc); 
    holder.put("homeMobileNetworkCode", mnc); 
    holder.put("radioType", "gsm"); 
    holder.put("carrier", "T-Mobile"); 
    holder.put("cellTowers", cellarray); 
    holder.put("wifiAccessPoints", wifiarray); 


} catch (JSONException e) { 
    e.printStackTrace(); 
} 
DefaultHttpClient client = new DefaultHttpClient(); 
HttpPost httpPost = new HttpPost("https://www.googleapis.com/geolocation/v1/geolocate?key="+API_key); 
StringEntity stringEntity = null; 

try { 
    stringEntity = new StringEntity(holder.toString()); 
    stringEntity.setContentType("application/json"); 

    Log.v("zf",stringEntity.getContentType().toString()); 

} catch (UnsupportedEncodingException e) { 
    e.printStackTrace(); 
} 

httpPost.setEntity(stringEntity); 
HttpResponse httpResponse = null; 
try { 
    httpResponse = client.execute(httpPost); 
} catch (ClientProtocolException e) { 
    e.printStackTrace(); 
} catch (IOException e) { 
    e.printStackTrace(); 
} 
+0

सेंसर परम आपके url – 1Mayur

+1

इस उदाहरण में से समाप्त करने के लिए जोड़ने का प्रयास करें, जियोकोडिंग API पर "1600 एम्फीथिएटर पार्कवे, माउंटेन व्यू, सीए" एक प्रश्न के लिए एक json प्रतिक्रिया का अनुरोध करता है/मानचित्र/एपीआई/जियोकोड/जेसन? पता = 1600 + एम्फीथिएटर + पार्कवे, + माउंटेन + व्यू, + सीए और सेंसर = true_or_false हमने इस उदाहरण में सेंसर पैरामीटर को एक वैरिएबल true_or_false के रूप में छोड़ दिया है ताकि आप इस मान को इस पर सेट कर सकें या तो सच या गलत स्पष्ट रूप से। – 1Mayur

उत्तर

0

संभावित कारण # 1: अपने यूआरएल में सेंसर मान जोड़ें, यह वैकल्पिक नहीं है!

संभावित कारण # 2: क्या आपने अपने एपीआई कंसोल में जिओलोकेशन सेवा सक्षम की है?

संभावित कारण # 3: क्या आपने अपने एपीआई कंसोल में अपनी बिलिंग जानकारी सेट की है?

"code": 403, 
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed." 

जाओ डेवलपर कंसोल और साख के तहत "आपके Android ऐप्स पर उपयोग प्रतिबंधित" के तहत अपने ऐप को जोड़ने: जब आप स्ट्रिंग प्रतिक्रिया पढ़ने

0

त्रुटि का कारण स्पष्ट है। http://maps.googleapis.com:

 संबंधित मुद्दे

  • कोई संबंधित समस्या नहीं^_^