2012-07-05 183 views
2

我正在建立一個移動網站,它將跟蹤手機的位置,然後將執行基於位置的搜索。任何人都可以幫助如何獲得手機的位置。我正在使用jquerymobile和php。跟蹤手機的位置

+0

您不需要找到移動的位置,製作一個移動應用程序,它會定期將其位置發送到您的網站。 – Lucifer

回答

1

還有HTML5地理位置API有提供基於Web的API一些其他的選擇。

西班牙電信已經通過兩個網絡API,並從Bluevia https://bluevia.com/en/ 一個Android SDK AT &牛逼提供位置開發商對位置http://developer.att.com/developer/apiLandingPage.jsp?passedItemId=9700218 Verizon公司類似的API還提供了一個位置API太http://developer.verizon.com/content/vdc/en/verizon-tools-apis/verizon_apis/network-api.html

這也是值得注意的是,網絡運營商目前正在推出OneAPI標準,該標準爲開發人員提供了一個單一API,以便在所有網絡(包括位置)上使用。迄今爲止已在加拿大發布http://oneapi-gw.gsma.com/

1

您需要使用HTML5地理位置API:

navigator.geolocation.watchPosition(locationSuccess, locationError, {timeout: 30000}); 

function locationSuccess(position) 
{ 
    // this is your position as a LatLng object. use it however you need 
    var latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 
} 

function centerOnLocationError(err) 
{ 
    if (err.code == 1) 
     alert("You must allow this website to use the Geolocation API to access your position."); 
    else if (err.code == 3) 
     alert("Unfortunately, your position request timed out."); 
    else 
     alert("Unfortunately, your position could not be determined."); 
}