`

google GeoLocation API调用请求

    博客分类:
  • J2ME
阅读更多

geolocation 定位可以基于ip, wifi和手机基站,示例是一个基于手机基站定位的例子

 

请求
POST /loc/json HTTP/1.1 
Host: www.google.com 

Accept: */*
Content-Type: application/json
Cache-Control: no-cache
Pragma: no-cache
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Proxy-Connection: Keep-Alive
Host: www.google.com
Content-Length: 402

{ "access_token" : "2:bQ-zHwG1xLdiP-sF:3li7KSH1OSqgYn1D", "host" : "code.google.com", "radio_type" : "unknown", "request_address" : true, "version" : "1.1.0",  "cell_towers": [
    {
      "cell_id": "42",
      "location_area_code": 415,
      "mobile_country_code": 310,
      "mobile_network_code": 410,
      "age": 0,
      "signal_strength": -60,
      "timing_advance": 5555
    } ] }

 

响应

HTTP/1.1 200 OK
Content-Type: application/json
Date: Wed, 29 Apr 2009 07:26:28 GMT
Expires: Wed, 29 Apr 2009 07:26:28 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
Content-Length: 262
Server: GFE/2.0

{"location":{"latitude":51.0,"longitude":-0.1,"address":{"country":"United Kingdom","country_code":"GB","region":"West Sussex","county":"Mid Sussex","city":"Haywards Heath","street":"Fairford Close","street_number":"12","postal_code":"RH16 3"},"accuracy":787.0}}

 

 

协议详情请参见:

http://code.google.com/apis/gears/geolocation_network_protocol.html

分享到:
评论
1 楼 dsafdsaf 2010-04-14  
請問一下,這是j2me所引用的嗎?
查過網路上是說暫時沒有,需用Web才可,所以有了這個想法,j2me接收Webserver,就可以知經緯度了!

相关推荐

Global site tag (gtag.js) - Google Analytics