編輯:Android開發實例
數據提供網站:http://www.minigps.net
接口使用和google以前的loc json一樣:
The request body must be formatted as JSON. The following fields are supported, and all fields are optional:
homeMobileCountryCode
: The mobile country code (MCC) for the device's home network.homeMobileNetworkCode
: The mobile network code (MNC) for the device's home network.radioType
: The mobile radio type. Supported values are gsm
, cdma
, and wcdma
.carrier
: The carrier name.cellTowers
: An array of cell tower objects. See the Cell Tower Objects section below.wifi_access_points
: An array of WiFi access point objects. See the WiFi Access Point Objects section below.
- {
- "homeMobileCountryCode": 310,
- "homeMobileNetworkCode": 410,
- "radioType": "gsm",
- "carrier": "Vodafone",
- "cellTowers": [
- // See the Cell Tower Objects section below.
- ],
- "wifiAccessPoints": [
- // See the WiFi Access Point Objects section below.
- ]
- }
The request body's cellTowers
array contains zero or more cell tower objects. All fields are optional.
cellId
: Unique identifier of the cell. On GSM, this is the Cell ID (CID); CDMA networks use the Base Station ID (BID).locationAreaCode
: The Location Area Code (LAC) for GSM networks; CDMA networks use Network ID (NID).mobileCountryCode
: The cell tower's Mobile Country Code (MCC).mobileNetworkCode
: The cell tower's Mobile Network Code. This is the MNC for GSM, or the System ID (SID) for CDMA.age
: The number of milliseconds since this cell was primary. If age is 0, the cellId
represents a current measurement.signalStrength
: Radio signal strength measured in dBm.timingAdvance
: The timing advance value.An example cell tower object is below.
- {
- "cellId": 42,
- "locationAreaCode": 415,
- "mobileCountryCode": 310,
- "mobileNetworkCode": 410,
- "age": 0,
- "signalStrength": -60,
- "timingAdvance": 5555
- }
js示例代碼:請參考 http://www.minigps.net/map.html的源代碼
js示例代碼:請參考 http://www.minigps.net/map.html的源代碼
var mcc = $("#mcc").val().replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' ); var mnc = $("#mnc").val().replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' ); var lac = $("#lac").val().replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' ); var cellid = $("#cellid").val().replace(/^\s\s*/, '' ).replace(/\s\s*$/, '' ); var celltower1 = { cell_id: cellid, location_area_code: lac, mobile_country_code: mcc, mobile_network_code: mnc, age: 0, signal_strength: -65 }; var celltowers =new Array(celltower1); var thing = { version : "1.1.0", host : "maps.google.com", cell_towers: celltowers }; var encoded = $.toJSON(thing); // '{"plugin":"jquery-json","version":2.3}' if (mcc != 460) { showMap = 2; map = mapFactory(); } else { showMap = 1; map = mapFactory(); } $.ajax({ url : "/minigps/map/google/location", type : "POST", contentType: "application/json; charset=utf-8", dataType : 'json', data: encoded, success : function(response) { //if ( typeof response !== "string" || !response ) { // return null; // } // Make sure leading/trailing whitespace is removed (IE can't handle it) //response = eval('(' + data + ')'); //var decodedObject = eval('(' + response.responseText + ')'); //data = '{"location" :{"latitude" : 51.0,"longitude" : -0.1,"altitude" : 30.1,"accuracy" : 1200.4,"altitude_accuracy" : 10.6, "address" : { "street_number" : "100", "street" : "Amphibian Walkway","postal_code" : "94043","city" : "Mountain View","county" : "Mountain View County", "region" : "California","country" : "United States of America", "country_code" : "US", },}, "access_token" : "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe" }'; //var decodedObject = $.parseJSON(json); //alert(response.access_token); var location = response.location; var lat = location.latitude; var lon = location.longitude; var address = location.address.street_number + " " + location.address.street + " " +location.address.city + " " + location.address.county + " " + location.address.country; mapPaneTo(map, lon, lat, address); }, error : function(er) { alert('基站信息不存在,請從手機上讀取正確的基站信息。'); } });
http接口示例源代碼:
request URL:http://www.minigps.net/minigps/map/google/location Request Method:POST Status Code:200 OK Request Headersview source Accept:application/json, text/javascript, */*; q=0.01 Accept-Charset:GBK,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:zh-CN,zh;q=0.8 Connection:keep-alive Content-Length:191 Content-Type:application/json; charset=UTF-8 Cookie:bdshare_firstime=1356366713546; JSESSIONID=68243935CD3355089CF07A3A22AAB372 Host:www.minigps.net Origin:http://www.minigps.net Referer:http://www.minigps.net/map.html User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4 X-Requested-With:XMLHttpRequest Request Payload {"version":"1.1.0","host":"maps.google.com","cell_towers":[{"cell_id":"3721","location_area_code":"9779","mobile_country_code":"460","mobile_network_code":"0","age":0,"signal_strength":-65}]} Response Headersview source Content-Type:application/json Date:Sat, 12 Jan 2013 06:03:15 GMT Server:Apache-Coyote/1.1 Transfer-Encoding:chunked
轉自:http://blog.csdn.net/echo3/article/details/8544087
Android提供了許多方法來控制播放的音頻/視頻文件和流。其中該方法是通過一類稱為MediaPlayer。Android是提供MediaPlayer類訪問內置的媒體播放
Android中可以直接在位圖上進行人臉檢測。Android SDK為人臉檢測
本文實例講述了Android編程之OpenGL繪圖技巧。分享給大家供大家參考,具體如下: 很久不用OpenGL ES繪圖,怕自己忘記了,於是重新復習一遍,順便原理
可以顯示在的Android任務,通過加載進度條的進展。進度條有兩種形狀。加載欄和加載微調(spinner)。在本章中,我們將討論微調(spinner)。Spinner 用