小编Jag*_*gan的帖子

显示 NMEA 语句?

任何人都可以帮助显示 NMEA 句子,如 $GPRMC ..... 我正在使用以下代码:

public class SampleNMEA extends Activity implements LocationListener, GpsStatus.Listener,GpsStatus.NmeaListener{

    LocationManager lm;
    TextView output;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        output = (TextView)findViewById(R.id.out);
        lm = (LocationManager) getSystemService(LOCATION_SERVICE);

        lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 60000,10,this);
        final Location location=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);


        output.append("\nBelow Data is about the your location:");

        output.append("\n\n\nLatit:"+location.getLatitude());
        output.append("\n\nLongitude:"+location.getLongitude());
        output.append("\n\nTime: "+location.getTime());


    }
    public void onLocationChanged(Location location) 
    {
        output.append("\n\n\nLatitude:"+location.getLatitude());
        output.append("\n\nLongitude:"+location.getLongitude());
        output.append("\n\nTime: "+location.getTime());
    }

    public void onProviderDisabled(String arg0) {
        // TODO Auto-generated method stub

    } …
Run Code Online (Sandbox Code Playgroud)

android

2
推荐指数
1
解决办法
1万
查看次数

使用GPS(LocationManager)如何获取当前时间?

我正在开发一个GPS应用程序.这将每隔一小时将位置数据发送到服务器.

在这里我使用以下代码:

location.getLatitude();
location.getLongitude();
location.getTime();
Run Code Online (Sandbox Code Playgroud)

使用此代码我正确地获得了纬度和经度以及时间,但我得到了一些13位数而不是时间.我做了一些研究,我发现这是当前时间的秒.

所以现在我需要将这个13位数转换成特定的格式.

java android

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×2

java ×1