-3

what is the code to get current location's latitude and longitude in php.Later I have to use this lat-long value to plot marker in google map.

Neeraja
  • 11
  • 2
  • go to this http://developer.android.com/reference/android/location/Location.html .................................. or this http://stackoverflow.com/questions/17983865/making-a-location-object-in-android-with-latitude-and-longitude-values – Hytool Jul 10 '15 at 04:51

2 Answers2

0

for this you need to create a webs service in php which stores the current lat,lng of the device and than create a new web service which gives this lat,lng back to the android app and you can user lat,lng to show the marker on google map...

Ankit Verma
  • 136
  • 4
  • 10
0
create table to store lat,lng 
id,lat,lng
than 

create store.php file 
code to store lat,lng in table in php
$lat= $_POST['lat'];
$lng=$_POST['lng'];
$sql="insert into location values('null','$lat','$lng')";
$result=mysql_query($sql);
if($result>0)
{
  echo '1';
}else
{
echo '0';
}

call this file using url in android code 

for example 
54.123.54.195/myapp/store.php


now to fetch the lat,lng make an new file fetch.php

 $sql="select * from location";
 $result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{

    json_encode($row);

}

call the fetch.php same as above file in your android code

for example 
54.123.54.195/myapp/fetch.php

you will get data as json and you can use in your code to show marker 
Ankit Verma
  • 136
  • 4
  • 10