【问题标题】:How can I get the current location lat -long values in php for using in android如何在 php 中获取当前位置 lat -long 值以便在 android 中使用
【发布时间】:2015-09-28 17:22:23
【问题描述】:

在 php 中获取当前位置的纬度和经度的代码是什么。稍后我必须使用这个 lat-long 值在谷歌地图中绘制标记。

【问题讨论】:

标签: php android


【解决方案1】:

为此,您需要在 php 中创建一个 web 服务,该服务存储设备的当前 lat、lng,然后 创建一个新的网络服务,将这个 lat,lng 返回到 android 应用程序,您可以使用 lat,lng 在谷歌地图上显示标记...

【讨论】:

    【解决方案2】:
    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 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-20
      • 1970-01-01
      • 2015-01-25
      • 1970-01-01
      相关资源
      最近更新 更多