モバイルの場所を追跡し、場所に基づいた検索を行うモバイル用の Web サイトの構築に取り組んでいます。携帯電話の位置を取得する方法を教えてください。jquerymobile と php を使用しています。
2 に答える
1
HTML5 Geolocation 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.");
}
于 2012-07-05T05:50:18.203 に答える
1
HTML5 Geolocation API だけでなく、Web ベースの API を提供するオプションがいくつかあります。
Telefonicaは、Web API とBluevia の Android SDK の両方を介して開発者が場所を利用できるようにしましたhttps://bluevia.com/en/ ?passedItemId=9700218 Verizon もロケーション API を提供していますhttp://developer.verizon.com/content/vdc/en/verizon-tools-apis/verizon_apis/network-api.html
また、ネットワーク オペレータが現在、開発者がすべてのネットワーク (場所を含む) で使用できる単一の API を提供する OneAPI 標準を展開していることも注目に値します。これはこれまでのところカナダでリリースされていますhttp://oneapi-gw.gsma.com/
于 2012-07-17T10:34:04.527 に答える