Hi,everyone
I have a problem not about a Android application,
but How to get the location (GPS,lat,lon that is enough) when the Android
user access my website or click a button on my site.
Of course , when user access mysite by normal 3G phone(NOT smartphone),
There is a admonition pop out just as ('This website well get you GPS
information, is that will be OK ?'),
and then you have a choose,Yes or No.
When you choose Yes ,my webserver will get your GPS (lat,lon)information,And
then I will know Where
you are (NOT very exactily,but probrablly).
It works very well on normal 3G phone.
Here is my example: (I live in Japan)
*sendGPS.html* //You can push the button you fit with (you are a au user,or
softbank user,or NTT DOcomo user )
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "
http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml ;
charset=Shift_JIS" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="isntruction" />
<title>title</title>
</head>
<body>
<!-- GPS for AU -->
<a
href="device:gpsone?url=getgps.php&ver=1&datum=0&unit=0&area=au">AU:get
your location</a><br />
<!-- GPS for Softbank User -->
<a href="location:auto?url=getgps.php&area=softbank">Softbank:get your
location</a><br />
<!-- GPS for Docomo User -->
<a href="getgps.php?area=docomo" lcs>Docomo:get your location</a><br />
</body>
</html>
---------------------------------------------------------------------------------------------------------
and then I will get your GPS information any do some anylization.
Here is the
* getgps.php //i get your location and echo them.*
**
---------------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "
http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml ;
charset=Shift_JIS" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="instrction" />
<title>title</title>
</head>
<body>
<?php
//a phone from au
if($_GET['area']=='au'){
$lat = $_GET{'lat'};
$lon = $_GET{'lon'};
$datum = $_GET{'datum'};
$unit = $_GET{'unit'};
$result = "lat " . $lat . "<br>\n"
. "lon " . $lon . "<br>\n"
. "datum " . $datum . "<br>\n"
. "unit " . $unit;
echo $result;
}
//a phone from softbank
elseif($_GET['area']=='softbank'){
$pos = $_GET['pos'];
$pos_arr = explode("E", $pos);
$lat = str_replace("N", "", $pos_arr[0]);
$lon = $pos_arr[1];
$lon_arr = explode('.', $lon);
$lat_arr = explode('.', $lat);
$lon = intval($lon_arr[0]) + intval($lon_arr[1]) / 60 +
(intval($lon_arr[2]) + intval($lon_arr[3]) / 1000) / 3600;
$lat = intval($lat_arr[0]) + intval($lat_arr[1]) / 60 +
(intval($lat_arr[2]) + intval($lat_arr[3]) / 1000) / 3600;
$result = "lat " . $lat . "<br>\n"
. "lon " . $lon . "<br>\n";
echo $result;
}
//a phone from NTT docomo
elseif($_GET['area']=='docomo'){
echo $pos = $_GET['pos'];
$lat = $_GET['lat'];
$lon = $_GET['lon'];
$geo = $_GET['geo'];
$xacc = $_GET{'x-acc'};
$result = "lat " . $lat . "<br>\n"
. "lon " . $lon . "<br>\n"
. "geo " . $geo . "<br>\n"
. "xacc " . $xacc;
echo $result;
}
?>
</body>
</html>
---------------------------------------------------------------------------------------------------------
BUT HOW about a Android or iphone.
*How to get the GPS from Android or iphone user?*
Gould any kindly one help me ?
thank you very much.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en